Reference targetName; try { targetName = (process.sfCompleteName()); } catch (Exception ex) { targetName=null; } TerminationRecord status= new TerminationRecord( "test complete", "sfDaemon forced to terminate ", targetName);  try { process.sfTerminate(status); } finally {  detach(); }
system.terminateSystem("test complete"); detach();
    public synchronized void dispose() throws RemoteException {        //catch already done        if(!isRunning() ) {            return;        }        Reference targetName;        try {            targetName = (process.sfCompleteName());        } catch (Exception ex) {            targetName=null;        }        TerminationRecord status= new TerminationRecord(                "test complete",                "sfDaemon forced to terminate ", targetName);        try {            process.sfTerminate(status);        } finally {            //whether this worked or not, we are finished here.            detach();        }    }