[JBoss Transactions Development] - JTA 1.2 Implementation Work
by Paul Robinson
Paul Robinson [https://community.jboss.org/people/paul.robinson] created the discussion
"JTA 1.2 Implementation Work"
To view the discussion, visit: https://community.jboss.org/message/816442#816442
--------------------------------------------------------------
h1. WARNING: THIS IS NOT YET READY FOR REVIEW.
This document discusses the outstanding issues and design decisions relating to our implementation of the JTA 1.2 specification.
The JTA 1.2 Spec and JavaDoc can be obtained from https://java.net/projects/jta-spec/sources/spec-source-repository/show here.
The two major changes are @Transactional (EJB-like transaction annotations for managed beans) and @TransactionScoped (A CDI scope tied to the lifecycle of the active transaction). Each of these is covered in it's own section bellow. There are some smaller changes too, for which it is yet to be determinned if they require any code changes. These are all discussed in the "Other Changes" section.
h3. @TransactionScoped
Implementing a new context in CDI is relativly straight-forward. You just need to implement the javax.enterprise.context.spi.Context interface. Here's the pseudo code for this impl:
public class TransactionContext implements Context {
private TransactionalBeanStore //Maintains a map of transaction to asociated beans. Garbage collection method is open for discussion (see later)
public Class<? extends Annotation> getScope() {
return TransactionScoped.class;
}
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
bean = (PassivationCapabale) contextual
if (bean already in TransactionalBeanStore) {
return bean
} else if (creationalContext != null ) {
create new bean
add bean to TransactionalBeanStore
return bean
} else {
return null
}
}
public <T> T get(Contextual<T> contextual) {
return get(contextual, null);
}
public boolean isActive() {
return true if current transaction status in {STATUS_ACTIVE, STATUS_MARKED_ROLLBACK, STATUS_PREPARED, STATUS_UNKNOWN, STATUS_PREPARING, STATUS_COMMITTING, STATUS_ROLLING_BACK }
}
}
h4. Design Decisions
h6. Do we Implement from scratch or extend a Weld Abstract Context?
Weld implements many different Contexts (SessionScoped, ApplicationScoped, RequestScoped, etc) and as a result many of the common implementation details have been abstracted into a largish class heirachy, making the actual implementations of the specific Contexts much simpler. We may be able to extend one of these Abstract Contexts. However, it's not clear to me exactly which one should be extended. Also, this would place a dependency on Weld, which I'm not sure is a good idea. I think it would be better to simply depend on the CDI API, so that our implemntatin remains portable. Also the implementation of the TransactionContext is quite simple, so we may be over-engineering the solution by extending a Weld Context.
h6. How are the out-of-scope beans garbage-collected?
The 'isActive' method ensures that the context is recognised as inactive, outside of an active transaction. However, the TransactionalBeanStore will collect garbage over time and so needs clearing at some point after the Context is no longer active. These are the current options that I think we have:
* AfterCompletion hook.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/816442#816442]
Start a new discussion in JBoss Transactions Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 8 months
[JBoss ESB Development] - Pipeline interceptor triggers multip
by Martin Myslík
Martin Myslík [https://community.jboss.org/people/m.myslik] created the discussion
"Pipeline interceptor triggers multip"
To view the discussion, visit: https://community.jboss.org/message/816142#816142
--------------------------------------------------------------
I am working on a project that "sniffs" (intercepts) all messages that are being send through ESB.
I use JBoss AS 6 with ESB 4.11. I am sending both esb-aware and JMS messages and everything works, but it seems that my interceptor intercepts every message mulptiple times.
At the moment, the Interceptor class just prints the concent + some other stuff to console. When I send a message, it displays the sent message multiple times (3 times to be more specific).
So my question is: *Why?*. Is this normal behavior? I have no clue where the mistake could be. I think that is could be one of these two options:
1) I have some error in my sending class, but I dont think thats the issue, since I use simply one serviceInvoker and my code is very similar to sample quickstarts. Standard output from gateway listeners also indicate that message is sent only ones...
2) Pipeline Interceptor intercepts the message multiple times, every time at a different stage of the pipeline. But how to test if this is the issue?
My properties file section for interceptors looks like this:
<properties name="interceptors">
<property name="org.jboss.soa.esb.pipeline.failure.interceptors" value="interceptor.Interceptor"/>
<property name="org.jboss.soa.esb.pipeline.instantiate.interceptors" value="interceptor.Interceptor"/>
<property name="org.jboss.soa.esb.pipeline.start.interceptors" value="interceptor.Interceptor"/>
<property name="org.jboss.soa.esb.pipeline.end.interceptors" value="interceptor.Interceptor"/>
</properties>
I tried to delete some of the properties but then it either doesnt intercept anything at all or it triggers multiple times!
Thanks for any tips!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/816142#816142]
Start a new discussion in JBoss ESB Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 8 months
[Javassist Development] - Probleme avec le Hotswap de Javassist
by heavenkhn
heavenkhn [https://community.jboss.org/people/heavenkhn] created the discussion
"Probleme avec le Hotswap de Javassist"
To view the discussion, visit: https://community.jboss.org/message/815952#815952
--------------------------------------------------------------
import java.io.*;
import com.sun.jdi.connect.IllegalConnectorArgumentsException;
import javassist.util.HotSwapper;
public class Test {
public static void main(String[] args) {
HotSwapper hs = null;
try {
hs = new HotSwapper(8000);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalConnectorArgumentsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
new HelloWorld().print();
File newfile = new File("bin
logging
HelloWorld.class");
byte[] bytes = new byte[(int)newfile.length()];
try {
new FileInputStream(newfile).read(bytes);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("** reload a logging version");
HelloWorld hl = new HelloWorld();
String name = hl.getClass().getName();
System.out.println(name);
hs.reload(name , bytes);
new HelloWorld().print();
newfile = new File("HelloWorld.class");
bytes = new byte[(int)newfile.length()];
try {
new FileInputStream(newfile).read(bytes);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("** reload the original version");
hs.reload("HelloWorld", bytes);
new HelloWorld().print();
}
}
et voila ce que sa donne dans eclipse:
Listening for transport dt_socket at address: 8000
hello world
** reload a logging version
HelloWorld
Exception in thread "HotSwap" java.lang.NoClassDefFoundError: class names do not match
at com.sun.tools.jdi.VirtualMachineImpl.redefineClasses(VirtualMachineImpl.java:331)
at javassist.util.HotSwapper.hotswap(HotSwapper.java:250)
at javassist.util.HotSwapper$1.run(HotSwapper.java:224)
Exception in thread "main" java.lang.RuntimeException: failed to reload: HelloWorld
at javassist.util.HotSwapper.reload2(HotSwapper.java:204)
at javassist.util.HotSwapper.reload(HotSwapper.java:160)
at Test.main(Test.java:38)
Sachant que Hello world a le code suivant :
public class HelloWorld {
public void print() {
System.out.println("hello world");
this.x=2;
}
public int x;
}
Pourquoi ces exceptions sont-ils apparus ???
Merci.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/815952#815952]
Start a new discussion in Javassist Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 8 months
[JBoss AS 7 Development] - Logging Id's
by Thomas Diesler
Thomas Diesler [https://community.jboss.org/people/thomas.diesler] modified the document:
"Logging Id's"
To view the document, visit: https://community.jboss.org/docs/DOC-16810
--------------------------------------------------------------
Logging id ranges for JBoss AS7 i18n message interfaces.
|| %1,3% *Status* ||
| C | = | Complete |
| I | = | In Progress |
| P | = | Merged, but not complete |
| W | = | Waiting Merge |
|| *Range* || *Subsystem
* || *Status
* ||
| *10100 - 10199* | *Transaction* | C |
| *10200 - 10399
* | *Clustering (https://community.jboss.org/docs/DOC-48622)**
* | C |
| *10400 - 10499* | *Connector**
* | C |
| *10500 - 10599* | *CLI (not applicable)
* | N/A |
| *10600 - 10699* | *Controller Client* | C |
| *10700 - 10799*, *18500 - 18699, 18800-18999* | *CMP* | C |
| *10800 - 10899* | *Host Controller (domain packages)* | C |
| *10900 - 10999, 16500 - 16599* | *Host Controller (host packages)* | C |
| *11000 - 11099, 16700 - 16799* | *EE* | C |
| *11100 - 11199* | *Embedded* | C |
| *11200 - 11299* | *JAXRS* | C |
| *11300 - 11399* | *JMX* | C |
| *11400 - 11499* | *JPA* | C |
| *11500 - 11599* | *Logging* | C |
| *11600 - 11699* | *Messaging* | C |
| *11700 - 11799* | *mod_cluster* | C |
| *11800 - 11899* | *Naming* | C |
| *11900 - 11999* | *OSGi* | C |
| *12000 - 12099, 16600 - 16699* | *Process Controller* | C |
| *12100 - 12199* | *Protocol* | C |
| *12200 - 12299* | *Management Client Content* | C |
| *12300 - 12399* | *Platform MBeans* | C |
| *12400 - 12499* | *Threads* | C |
| *12500 - 12599* | *PicketLink* | I |
| *12600 - 12699* | *JSF (proposed)* |
|
| *12700 - 13100* | *IIOP Common (proposed)* |
|
| *13100 - 13199* | *JDR* | C |
| *13200 - 13299* | *AppClient* | C |
| *13300 - 13399* | **Security*
* | C |
| *13400 - 13499, 14600 - 14899* | *Controller* | C |
| available block(s) |
|
|
| *14000 - 14099* | *JAXR* | W |
| *14100 - 14599* | *Ejb3* | P |
| **13400 - 13499, 14600 - 14899** | *Controller* | C |
| *14900 - 14999* | *Deployment Repository* | C |
| *15000 - 15099* | *Deployment Scanner* | C |
| *15100 - 15199* | *Domain Management HTTP Interface* | C |
| *15200 - 15299* | *Deployment Management* | C |
| *15300 - 15399* | *Network* | C |
| *15400 - 15499* | *Mail* | C |
| *15500 - 15699* | *Web Services (AS subsystem)* | C |
| *15700 - 15999*, *18700 - 18799* | *Server* | C |
| *1**6000 - 16099* | *Weld* | C |
| *16100 - 16199* | *EE Deployment* | C |
| *16200 - 16299* | *Configadmin* | C |
| *16300 - 16499* | *Jacorb* | C |
| *10900 - 10999, 16500 - 16599* | *Host Controller (host packages)* | C |
| *12000 - 12099, 16600 - 16699* | *Process Controller* | C |
| *11000 - 11099, 16700 - 16799* | *EE* | C |
| *16800 - 16899* | *Patching (Library)* | C |
| *16900 - 16999* | *Patching (Server)* |
|
| *17000 - 17099* | *POJO* | C |
| *17100 - 17199* | *Remoting* | W |
| *17200 - 17299* | *SAR* | W |
| *17300 - 17699* | *Web/Undertow (reserved)* | I |
| available block(s) |
|
|
| *18000 - 18399* | *Web* | C |
| *18400 - 18499* | *Xts* | C |
| *15700 - 15999, 18700 - 18799* | *Server* | C |
| available block(s) |
|
|
| *19000-19999* | *JSR-77* | I |
| *20000-20199* | *Camel* | I |
| *20200-20299* | *JipiJapa* | I |
| *20300-20399* | *Provision* |
|
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-16810]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 8 months
[JBoss ESB Development] - Sending a message through Scheduler
by Martin Myslík
Martin Myslík [https://community.jboss.org/people/m.myslik] created the discussion
"Sending a message through Scheduler"
To view the discussion, visit: https://community.jboss.org/message/811185#811185
--------------------------------------------------------------
Hi,
I am quite new to ESB and I would like to send messages from a service through simple scheduler. I have a class that has method which sends and ESB aware message:
+public void sendMessage(String message) throws Exception+
+ {+
+ // Create the delivery adapter for the target service (cache it)+
+ System.setProperty("javax.xml.registry.ConnectionFactoryClass",+
+ "org.apache.ws.scout.registry.ConnectionFactoryImpl");+
+ // Create the delivery adapter for the target service (cache it)+
+ ServiceInvoker deliveryAdapter = new ServiceInvoker("FirstServiceESB",+
+ "SimpleListener");+
+ // Create and populate the request message...+
+ Message requestMessage = MessageFactory.getInstance().getMessage(+
+ MessageType.JBOSS_XML);+
+ requestMessage.getBody().add(message);+
+ // Deliver the request message synchronously - timeout after 20+
+ // seconds...+
+ deliveryAdapter.deliverAsync(requestMessage);+
+ }+
I found only very vague tutorials on how to implement Scheduler (I mean in jboss-esb.xml file). How do I trigger this method? Can you show me and example jboss-esb.xml configuration taht would call *sendMessage()* function multiple times?+
+
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/811185#811185]
Start a new discussion in JBoss ESB Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 8 months