Метод обработчика уведомлений JavaSpaces

Я пытаюсь реализовать метод обработчика, который может уведомлять в зависимости от параметров, которые передаются в пространство. Например, у меня есть следующий код, который помещает шаблон в пространство, где tab - это имя комнаты:

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();
        }

    }

Есть ли способ узнать, какой параметр был передан для метода уведомления, при попытке обработать регистрацию события, как показано ниже?

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

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

0 ответов

Другие вопросы по тегам