View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    * 
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.river.norm.event;
19  
20  import net.jini.core.event.RemoteEvent;
21  
22  /**
23   * Object associated with an <code>EventType</code> so it can ensure
24   * that the lease on an event notification is still valid and notify
25   * the client when a exception occurs in the course of attempting to
26   * send an event.
27   *
28   * @author Sun Microsystems, Inc.
29   * @see EventType
30   * @see EventTypeGenerator
31   */
32  public interface SendMonitor {
33      /**
34       * Method called when an attempt to send the event associated with
35       * this object results in a definite exception
36       * (e.g. <code>java.rmi.NoSuchObjectException</code> or any other
37       * <code>Throwable</code> that is not a subclass of
38       * <code>java.rmi.RemoteException</code>.
39       * <p>
40       * The caller will own no locks when calling this method.
41       * @param type the object that generated the event
42       * @param ev   the remote event that could not be sent
43       * @param registrationNumber of the event registration that
44       *             generated the exception.  This can be used
45       *             to call <code>EventType.clearListenerIfSequenceMatch</code>
46       *             ensure only the registration that cause the problem 
47       *             gets cleared.
48       * @param t    the definite exception that caused us to give up
49       *             sending the event
50       */
51      public void definiteException(EventType           type,
52                                    RemoteEvent         ev,
53  				  long                registrationNumber,
54                                    Throwable           t);
55      /**
56       * Should return <code>true</code> if the lease associated with this
57       * event is still valid and <code>false</code> otherwise.
58       * <p>
59       * The caller will own no locks when calling this method.
60       */
61      public boolean isCurrent();
62  }