01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.event;
20:
21: import org.apache.openjpa.lib.util.Closeable;
22:
23: /**
24: * An entity that is responsible for communicating commit
25: * notification to other {@link RemoteCommitEventManager}s. Each
26: * event manager creates a remote commit provider, based on
27: * the values of the <code>openjpa.RemoteCommitProvider</code>
28: * configuration property.
29: * An adapter that implements {@link TransactionListener} is
30: * registered with each {@link org.apache.openjpa.kernel.Broker}. This adapter
31: * invokes <code>broadcast</code>, which is responsible for
32: * notifying other remote commit provider objects of the commit changes.
33: * Upon receiving a notification from a different remote commit provider,
34: * a provider must notify all local remote commit listeners via the
35: * {@link RemoteCommitEventManager#fireEvent} method.
36: * A remote commit provider <b>must not</b> fire remote events for
37: * commits that originated with a local broker.
38: *
39: * @author Patrick Linskey
40: * @since 0.2.5.0
41: */
42: public interface RemoteCommitProvider extends Closeable {
43:
44: /**
45: * Set the "owning" remote event manager to notify when remote events
46: * are received from remote sources.
47: */
48: public void setRemoteCommitEventManager(RemoteCommitEventManager mgr);
49:
50: /**
51: * Notifies other remote event managers in this JVM and on other machines
52: * of changes to the cache. This method must not notify the
53: * event manager associated with the broker that originated this commit.
54: */
55: public void broadcast(RemoteCommitEvent event);
56:
57: /**
58: * Free the resources used by this provider.
59: */
60: public void close();
61: }
|