RE: Scheduling with WOTimer
RE: Scheduling with WOTimer
- Subject: RE: Scheduling with WOTimer
- From: "Xia, Wen" <email@hidden>
- Date: Tue, 9 Mar 2004 15:46:39 -0800
Yeah, I did try to use the static method application(). Here is what I did:
My timer extends the Application class. Inside timer, I tried to get the
current WOApplication class using "static Application ap = (Application)
application();" And the timer is created in the constructor of the
Application class. When I run the application, I encounter the following
error message. Did I do something wrong here? Please advise. Thank you.
[2004-03-09 15:11:12 PST] <main> Unable to establish a connection to port
50442 on this host. Perhaps this port is already in use by another
WebObjects application instance.
[2004-03-09 15:11:12 PST] <main> <WOApplication>: Cannot be initialized.null
[2004-03-09 15:11:12 PST] <main> A fatal exception occurred: null:
<WOApplication>: Cannot be initialized.
[2004-03-09 15:11:12 PST] <main>
com.webobjects.foundation.NSForwardException for
com.webobjects.foundation.NSForwardException for java.net.BindException:
Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
at java.net.ServerSocket.bind(ServerSocket.java:309)
at java.net.ServerSocket.<init>(ServerSocket.java:183)
at
com.webobjects.appserver._private.WODefaultAdaptor._initServerSocket(WODefau
ltAdaptor.java:157)
at
com.webobjects.appserver._private.WODefaultAdaptor.<init>(WODefaultAdaptor.j
ava:140)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at
com.webobjects.foundation._NSUtilities.instantiateObject(_NSUtilities.java:5
29)
at
com.webobjects.appserver.WOApplication.adaptorWithName(WOApplication.java:90
9)
at
com.webobjects.appserver.WOApplication._initAdaptors(WOApplication.java:955)
at
com.webobjects.appserver.WOApplication.<init>(WOApplication.java:509)
at Application.<init>(Application.java:34)
at dpScheduler.<init>(dpScheduler.java:22)
at Application.<init>(Application.java:49)
at dpScheduler.<init>(dpScheduler.java:22)
at Application.<init>(Application.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at
com.webobjects.appserver.WOApplication.main(WOApplication.java:296)
at Application.main(Application.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:71)
StateNet has exited with status 1.}
-----Original Message-----
From: Jonathan Rochkind [mailto:email@hidden]
Sent: Tuesday, March 09, 2004 3:05 PM
To: Xia, Wen; 'WOdev List List'
Subject: RE: Scheduling with WOTimer
No, the static method application() in WOApplication.
WOApplication:
public static WOApplication application();
Can be called from anywhere. It's a static method. Returns the
current WOApplication class. You may have to sub-class it to your
custom sub-class, typically called 'Application'.
In a mulit-threaded scenario (which a timer certainly is), you should
ensure thread safe access to the variables you plan on modifying in
Application.
--Jonathan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.