src/org/nixos/disnix/service/DisnixSignalHandler.java
/**
	 * Handles an incoming D-Bus signal
	 * 
	 * @param s Representation of the received D-Bus signal
	 */
Handles an incoming D-Bus signal

@param s Representation of the received D-Bus signal
Handles an incoming D - Bus signal @param s Representation of the received D - Bus signal
public void handle(DBusSignal s)
	{	
		DisnixThread thread;
		int pid = -1;
		/* Only handle signals that we expect */
		if(s instanceof Disnix.finish)
		{
			pid = ((Disnix.finish)s).pid;
			System.err.println("Caught finish signal from pid: "+pid);
		}
		else if(s instanceof Disnix.success)
		{
			pid = ((Disnix.success)s).pid;
			System.err.println("Caught success signal from pid: "+pid);
		}
		else if(s instanceof Disnix.failure)
		{
			pid = ((Disnix.failure)s).pid;
			System.err.println("Caught failure signal from pid: "+pid);
		}
		else
		{
			System.err.println("Caught unknown signal: " + s);
			return;
		}
		/* Get the corresponding pid from the table, or wait until it has been added */
		do
		{
			thread = pids.remove(pid);
		}
		while(thread == null);
		/* Resume the thread attached to the received PID */
		thread.setSource(s);
		/* Wait for the thread to get suspended, before we attempt to resume it */
		while(!thread.isSuspended());
		thread.resume();
	}
public void handle ( DBusSignal s ) { DisnixThread thread ; int pid = - 1 ; /* Only handle signals that we expect */ if ( s instanceof Disnix . finish ) { pid = ( ( Disnix . finish ) s ) . pid ; System . err . println ( "Caught finish signal from pid: " + pid ) ; } else if ( s instanceof Disnix . success ) { pid = ( ( Disnix . success ) s ) . pid ; System . err . println ( "Caught success signal from pid: " + pid ) ; } else if ( s instanceof Disnix . failure ) { pid = ( ( Disnix . failure ) s ) . pid ; System . err . println ( "Caught failure signal from pid: " + pid ) ; } else { System . err . println ( "Caught unknown signal: " + s ) ; return ; } /* Get the corresponding pid from the table, or wait until it has been added */ do { thread = pids . remove ( pid ) ; } while ( thread == null ) ; /* Resume the thread attached to the received PID */ thread . setSource ( s ) ; /* Wait for the thread to get suspended, before we attempt to resume it */ while ( ! thread . isSuspended ( ) ) ; thread . resume ( ) ; }
Handles an incoming D-Bus signal
Handles an incoming D - Bus signal