Re: WO instance locks up and won't die.
Re: WO instance locks up and won't die.
- Subject: Re: WO instance locks up and won't die.
- From: Serge Froment <email@hidden>
- Date: Thu, 20 Nov 2003 10:08:12 -0500
Hi,
Here is some code I put in my Application constructor to easily get the
PID and some useful information about running WebObjects applications
in a platform-independant way:
// get version number from application bundle
NSDictionary info;
try
{
String infoPListPath = WOApplication.application().path() +
File.separator + "Contents" + File.separator + "Info.plist";
File file = new File(infoPListPath);
InputStream inputStream = new FileInputStream(file);
NSData data = new NSData(inputStream, (int) file.length());
info = NSPropertyListSerialization.propertyListFromData(data, "UTF-8");
}
catch (Exception e)
{
throw new IllegalStateException("Can't read Info.plist: " +
e.getMessage());
}
version = (String) info.valueForKey("CFBundleVersion");
// [WObug] #2260519: WOApplication.application().port() returns a
nonsensical result
int port = ((WOAdaptor)adaptors().objectAtIndex(0)).port();
// output everything to the log
NSLog.err.appendln(name() + " version " + version + ", port = " + port
+ ", pid = " + System.getProperty("com.webobjects.pid"));
Version is an instance variable of Application and it is used
everywhere I need to display version number.
Once the PID is in the log, I can look at /var/log to find the PID of
every running application. I could even write a shell script that kills
all instances by parsing the log files. I could write an even smarter
shell script that send a direct action to every running instance and
only kill those that don't respond.
Le 19 nov. 2003, ` 21:34, Marek Wawrzyczny a icrit :
You should be able to kill the offending java instance in terminal. It
does mean having to find the process id for the zombie instance but
that's not as difficult as it may seem. On OS X you can:
Serge Froment
http://www.serge-froment.com
_______________________________________________
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.