Information Technology Reference
In-Depth Information
import javax.jms.∗;
import clock.∗;
service ClockService {
recovery JMSError (JMSException e) {
System.out.println( "Method: " + transfer.getMethod());
System.out.println( "Host : " + transfer.getCurrentHost());
String[] s = new String[2];
s[0] = "tcp://host1:61616" ;
s[1] = "tcp://host2:61616" ;
setHosts(s);
System.out.println( "Switching to host1 and host2" );
}
protocol :jms{
options {
destinationClass = "org.apache.activemq.command.ActiveMQQueue" ;
initialContextFactory
= "org.apache.activemq.jndi.ActiveMQInitialContextFactory" ;
persist = true;
sendQueue = "REMOTEJ.SEND" ;
receiveQueue = "temporary" ; // or name e.g. REMOTEJ.RECEIVE
brokerURL = "tcp://localhost:61616" ;
serverThreads = 5;
receiveTimeout = 5000;
}
pointcut Date ClockDate.getDate () {
recovery = JMSError;
}
}
}
Figure 5.8.
JMS ClockService DDL.
The Transfer object is extracted from the message and the class name, the
method name to call and the method's parameters are extracted from the Transfer
object. An object cache is then searched for an instance of the requested class using
the class name as the key. If an instance exists in the cache it is used for the call,
otherwise a new instance is created, put in the cache and used for all subsequent
calls. The Java reflection API is then used to make the call using the object
instance, the method name and the parameters.
Following the call, the Transfer object is set with the result value of the
method call and passed back to the client, which extracts the return value and
passes it to the caller.
Search WWH ::




Custom Search