Time-Lag in HelloPublisher25
matthias Mar 11, 2002 5:19 AMHi,
i´m testing the HelloPublisher with JBoss2.4.4.
I have changed the code to use RMIConnectionFactory.
------Snipped from HelloPublisher25.java-------------------------------------------------------------
public static void main(String[] args) {
try {
//Create the HelloPublisher, giving it the name of the TopicConnection
//Factory and the Topic destination to use in lookup.
HelloPublisher25 publisher = new HelloPublisher25(
// Name of ConnectionFactory
"RMIConnectionFactory",
// Name of destination to publish to
"topic/testTopic"
);
// Publish 10 messages
for (int i = 1; i < 11; i++) {
String msg = "Hello World no. " + i;
System.out.println("Publishing message: " + msg);
publisher.publish(msg);
}
// Close down your publisher
System.out.println("before close publisher !") ;
publisher.close();
System.out.println("after close publisher !") ;
}catch(Exception ex) {
System.err.println("An exception occured while testing HelloPublisher25: " + ex);
ex.printStackTrace();
}
}
------Snipped from HelloPublisher25.java-------------------------------------------------------------
The Function publishes the messages, but when the Program ends, it
takes one minute, until the Program really stops, e.g. the DOS-Promt is visible.
I have started it with "ant jms-hello-publisher25"
---------------------------------System-Messages:----------------------------
jms-hello-publisher25:
[echo] Using resources from: D:\JBoss\examples\examples-2.4.4\examples/resources
[java] Publishing message: Hello World no. 1
[java] Publishing message: Hello World no. 2
[java] Publishing message: Hello World no. 3
[java] Publishing message: Hello World no. 4
[java] Publishing message: Hello World no. 5
[java] Publishing message: Hello World no. 6
[java] Publishing message: Hello World no. 7
[java] Publishing message: Hello World no. 8
[java] Publishing message: Hello World no. 9
[java] Publishing message: Hello World no. 10
[java] before close publisher !
[java] nach TopicSessionClose
[java] nach TopicConnectionClose
[java] after close publisher !
BUILD SUCCESSFUL
Total time: 1 minute 6 seconds
D:\JBoss\examples\examples-2.4.4\examples\build>
---------------------------------System-Messages:----------------------------
The Message "[java] after close publisher !" is shown fast, then it takes about one minute
until the following Messages "BUILD SUCCESSFUL...." are shown. What happens in
this time ?
regards Matthias