JavaSpaces Notify Handler Method

508 Views Asked by At

I am trying to implement a handler method which can a notify depending on the parameters that are passed into the space. E.g i have the following code which puts a template into space where tab is the name of a room:

private void createMessageListener(String tab) {
        // create the exporter
        Exporter myDefaultExporter =
                new BasicJeriExporter (TcpServerEndpoint.getInstance(0),
                        new BasicILFactory(), false, true);

        try {
            // register this as a remote object
            // and get a reference to the 'stub'
            msgListener = (RemoteEventListener) myDefaultExporter.export(this);

            // add the listener
            Message template = new Message(tab);
            regMsgs = space.notify(template, null, this.msgListener, Lease.FOREVER, null);
            seqMsgs = regMsgs.getSequenceNumber();


        } catch (Exception e) {
            e.printStackTrace();
        }

    }

Is there a way to find out what the parameter has been passed in for the notify method, when trying to handle the event registration as shown below??

public void notify(RemoteEvent arg0) throws UnknownEventException,
    RemoteException {

        ///Find out the parameter in the notification and then handle?
        }
    }
0

There are 0 best solutions below