You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2020/07/05 11:41:42 UTC
svn commit: r1879521 [17/37] - in
/river/jtsk/modules/modularize/apache-river: ./ browser/
browser/src/main/java/org/apache/river/example/browser/ extra/
groovy-config/ river-activation/ river-collections/
river-collections/src/main/java/org/apache/riv...
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventDataCursor.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventDataCursor.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventDataCursor.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventDataCursor.java Sun Jul 5 11:41:39 2020
@@ -1,40 +1,40 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.river.mercury;
-
-import java.io.Serializable;
-/**
- * Trivial class (struct) that simply holds the current read count
- * and the associated (next unread) read position. U?sed as the client-side
- * cookie for PersistentEventLog.
- * @since 2.1
- */
-class RemoteEventDataCursor implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final long readCount;
- private final long readPosition;
-
- RemoteEventDataCursor(long count, long cursor) {
- readCount = count;
- readPosition = cursor;
- }
-
- long getReadCount() { return readCount; }
- long getReadPosition() { return readPosition; }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.mercury.proxy;
+
+import java.io.Serializable;
+/**
+ * Trivial class (struct) that simply holds the current read count
+ * and the associated (next unread) read position. U?sed as the client-side
+ * cookie for PersistentEventLog.
+ * @since 2.1
+ */
+public class RemoteEventDataCursor implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final long readCount;
+ private final long readPosition;
+
+ public RemoteEventDataCursor(long count, long cursor) {
+ readCount = count;
+ readPosition = cursor;
+ }
+
+ public long getReadCount() { return readCount; }
+ public long getReadPosition() { return readPosition; }
+}
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorData.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorData.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorData.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorData.java Sun Jul 5 11:41:39 2020
@@ -1,51 +1,51 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.river.mercury;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import net.jini.id.Uuid;
-
-/**
- * Simple struct to hold the <code>Uuid</code> for a new
- * <code>RemoteEventIterator</code> instance and the first batch of
- * data.
- */
-class RemoteEventIteratorData implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * <code>Uuid</code> for iteration.
- */
- final Uuid uuid;
-
- /** Initial set of entries */
- final Collection events;
-
- /**
- * Creates a new RemoteEventIteratorData instance.
- * @param uuid value of <code>uuid</code> field.
- * @param events value of <code>events</code> field.
- */
- RemoteEventIteratorData(Uuid uuid, Collection events) {
- this.uuid = uuid;
- this.events = events;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.mercury.proxy;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+import net.jini.id.Uuid;
+
+/**
+ * Simple struct to hold the <code>Uuid</code> for a new
+ * <code>RemoteEventIterator</code> instance and the first batch of
+ * data.
+ */
+public class RemoteEventIteratorData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * <code>Uuid</code> for iteration.
+ */
+ final Uuid uuid;
+
+ /** Initial set of entries */
+ final Collection events;
+
+ /**
+ * Creates a new RemoteEventIteratorData instance.
+ * @param uuid value of <code>uuid</code> field.
+ * @param events value of <code>events</code> field.
+ */
+ public RemoteEventIteratorData(Uuid uuid, Collection events) {
+ this.uuid = uuid;
+ this.events = events;
+ }
+}
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorImpl.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorImpl.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-dl/src/main/java/org/apache/river/mercury/proxy/RemoteEventIteratorImpl.java Sun Jul 5 11:41:39 2020
@@ -1,178 +1,179 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.river.mercury;
-import java.io.IOException;
-import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import net.jini.core.constraint.RemoteMethodControl;
-import net.jini.core.event.RemoteEvent;
-import net.jini.event.InvalidIteratorException;
-import net.jini.event.RemoteEventIterator;
-import net.jini.id.ReferentUuid;
-import net.jini.id.ReferentUuids;
-import net.jini.id.Uuid;
-import net.jini.security.proxytrust.ProxyTrustIterator;
-import net.jini.security.proxytrust.SingletonProxyTrustIterator;
-
-import org.apache.river.proxy.ThrowThis;
-
-/**
- *
- *
- * @author Sun Microsystems, Inc.
- *
- * @since 1.1
- */
-class RemoteEventIteratorImpl implements RemoteEventIterator
-{
- /** Unique identifier for this registration */
- final Uuid registrationID;
-
- /** Unique identifier for this registration */
- final Uuid iteratorID;
-
- /** Reference to service implementation */
- final MailboxBackEnd mailbox;
-
- /** Event iterator **/
- private Iterator iter = null;
-
- /** Last remote event cookie */
- private Object lastEventCookie = null;
-
- /** lock object protecting <code>invalidated</code> flag. */
- private Object invalidatedLock = new Object();
-
- /**
- * Boolean flag indicating the (in)validity of this object.
- * If true, the object is invalid and all public method invocations
- * should throw InvalidIteratorException.
- */
- private boolean invalidated = false;
-
- /** Convenience constructor */
- RemoteEventIteratorImpl(Uuid id, Uuid regId, MailboxBackEnd srv,
- Collection evts)
- {
- if (id == null || regId == null || srv == null || evts == null)
- throw new IllegalArgumentException("Cannot accept null arguments");
- registrationID = regId;
- iteratorID = id;
- mailbox = srv;
- iter = evts.iterator();
- }
-
- // inherit javadoc from supertype
- public RemoteEvent next(long timeout)
- throws RemoteException, InvalidIteratorException
- {
- //TODO - implement timeout
- //TODO - handle ClassNotFoundException for getRemoteEvent() call
- checkState();
-
- if (timeout < 0) {
- throw new
- IllegalArgumentException("Timeout value must non-negative");
- }
-
- RemoteEvent re = null;
- LocalRemoteEventData lred = getNextValidLocalRemoteEventData(iter);
- if (lred != null) {
- re = lred.re;
- lastEventCookie = lred.cookie;
- } else { // get next batch of events, if any
- try {
- Collection events =
- mailbox.getNextBatch(
- registrationID, iteratorID, timeout,
- lastEventCookie);
- iter = events.iterator();
- lred = getNextValidLocalRemoteEventData(iter);
- if (lred != null) {
- re = lred.re;
- lastEventCookie = lred.cookie;
- }
- } catch (InvalidIteratorException iie) {
- invalidate();
- throw iie;
- } catch (ThrowThis tt) {
- tt.throwRemoteException();
- }
- }
- return re;
- }
-
- private static class LocalRemoteEventData {
- RemoteEvent re = null;
- Object cookie = null;
- LocalRemoteEventData(RemoteEvent re, Object cookie) {
- this.re = re;
- this.cookie = cookie;
- }
- }
-
- private LocalRemoteEventData getNextValidLocalRemoteEventData(Iterator i) {
- RemoteEventData rd = null;
- LocalRemoteEventData lrd = null;
- try {
- if (i!= null && i.hasNext()) {
- rd = (RemoteEventData)i.next();
- lrd = new LocalRemoteEventData(
- rd.getRemoteEvent(), rd.getCookie());
- }
- } catch (ClassNotFoundException cnfe) {
- lrd = getNextValidLocalRemoteEventData(i);
- }
-
- return lrd;
- }
-
- // inherit javadoc from supertype
- public void close() throws InvalidIteratorException {
- checkState();
- invalidate();
- }
-
- /**
- * Utility method that checks the validity of this object
- * and throws an exception if it's invalid.
- */
- private void checkState() throws InvalidIteratorException {
- synchronized (invalidatedLock) {
- if (invalidated) {
- throw new InvalidIteratorException();
- }
- }
- }
-
- /**
- * Utility method that marks this object as invalid.
- */
- private void invalidate() {
- synchronized (invalidatedLock) {
- invalidated = true;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.mercury.proxy;
+
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import net.jini.core.constraint.RemoteMethodControl;
+import net.jini.core.event.RemoteEvent;
+import net.jini.event.InvalidIteratorException;
+import net.jini.event.RemoteEventIterator;
+import net.jini.id.ReferentUuid;
+import net.jini.id.ReferentUuids;
+import net.jini.id.Uuid;
+import net.jini.security.proxytrust.ProxyTrustIterator;
+import net.jini.security.proxytrust.SingletonProxyTrustIterator;
+
+import org.apache.river.proxy.ThrowThis;
+
+/**
+ *
+ *
+ * @author Sun Microsystems, Inc.
+ *
+ * @since 1.1
+ */
+class RemoteEventIteratorImpl implements RemoteEventIterator
+{
+ /** Unique identifier for this registration */
+ final Uuid registrationID;
+
+ /** Unique identifier for this registration */
+ final Uuid iteratorID;
+
+ /** Reference to service implementation */
+ final MailboxBackEnd mailbox;
+
+ /** Event iterator **/
+ private Iterator iter = null;
+
+ /** Last remote event cookie */
+ private Object lastEventCookie = null;
+
+ /** lock object protecting <code>invalidated</code> flag. */
+ private Object invalidatedLock = new Object();
+
+ /**
+ * Boolean flag indicating the (in)validity of this object.
+ * If true, the object is invalid and all public method invocations
+ * should throw InvalidIteratorException.
+ */
+ private boolean invalidated = false;
+
+ /** Convenience constructor */
+ RemoteEventIteratorImpl(Uuid id, Uuid regId, MailboxBackEnd srv,
+ Collection evts)
+ {
+ if (id == null || regId == null || srv == null || evts == null)
+ throw new IllegalArgumentException("Cannot accept null arguments");
+ registrationID = regId;
+ iteratorID = id;
+ mailbox = srv;
+ iter = evts.iterator();
+ }
+
+ // inherit javadoc from supertype
+ public RemoteEvent next(long timeout)
+ throws RemoteException, InvalidIteratorException
+ {
+ //TODO - implement timeout
+ //TODO - handle ClassNotFoundException for getRemoteEvent() call
+ checkState();
+
+ if (timeout < 0) {
+ throw new
+ IllegalArgumentException("Timeout value must non-negative");
+ }
+
+ RemoteEvent re = null;
+ LocalRemoteEventData lred = getNextValidLocalRemoteEventData(iter);
+ if (lred != null) {
+ re = lred.re;
+ lastEventCookie = lred.cookie;
+ } else { // get next batch of events, if any
+ try {
+ Collection events =
+ mailbox.getNextBatch(
+ registrationID, iteratorID, timeout,
+ lastEventCookie);
+ iter = events.iterator();
+ lred = getNextValidLocalRemoteEventData(iter);
+ if (lred != null) {
+ re = lred.re;
+ lastEventCookie = lred.cookie;
+ }
+ } catch (InvalidIteratorException iie) {
+ invalidate();
+ throw iie;
+ } catch (ThrowThis tt) {
+ tt.throwRemoteException();
+ }
+ }
+ return re;
+ }
+
+ private static class LocalRemoteEventData {
+ RemoteEvent re = null;
+ Object cookie = null;
+ LocalRemoteEventData(RemoteEvent re, Object cookie) {
+ this.re = re;
+ this.cookie = cookie;
+ }
+ }
+
+ private LocalRemoteEventData getNextValidLocalRemoteEventData(Iterator i) {
+ RemoteEventData rd = null;
+ LocalRemoteEventData lrd = null;
+ try {
+ if (i!= null && i.hasNext()) {
+ rd = (RemoteEventData)i.next();
+ lrd = new LocalRemoteEventData(
+ rd.getRemoteEvent(), rd.getCookie());
+ }
+ } catch (ClassNotFoundException cnfe) {
+ lrd = getNextValidLocalRemoteEventData(i);
+ }
+
+ return lrd;
+ }
+
+ // inherit javadoc from supertype
+ public void close() throws InvalidIteratorException {
+ checkState();
+ invalidate();
+ }
+
+ /**
+ * Utility method that checks the validity of this object
+ * and throws an exception if it's invalid.
+ */
+ private void checkState() throws InvalidIteratorException {
+ synchronized (invalidatedLock) {
+ if (invalidated) {
+ throw new InvalidIteratorException();
+ }
+ }
+ }
+
+ /**
+ * Utility method that marks this object as invalid.
+ */
+ private void invalidate() {
+ synchronized (invalidatedLock) {
+ invalidated = true;
+ }
+ }
+}
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/pom.xml
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/pom.xml?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/pom.xml (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/pom.xml Sun Jul 5 11:41:39 2020
@@ -1,44 +1,51 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-~ Copyright (C) 2014 the original author or authors.
-~
-~ Licensed under the Apache License, Version 2.0 (the "License");
-~ you may not use this file except in compliance with the License.
-~ You may obtain a copy of the License at
-~
-~ http://www.apache.org/licenses/LICENSE-2.0
-~
-~ Unless required by applicable law or agreed to in writing, software
-~ distributed under the License is distributed on an "AS IS" BASIS,
-~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-~ See the License for the specific language governing permissions and
-~ limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.river</groupId>
- <artifactId>mercury</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.river.mercury</groupId>
- <artifactId>mercury-service</artifactId>
- <url>http://river.apache.org</url>
- <name>Module :: Mercury Service Implementation</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.river.mercury</groupId>
- <artifactId>mercury-dl</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.river</groupId>
- <artifactId>river-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ~ Copyright (C) 2014 the original author or authors. ~ ~ Licensed under
+ the Apache License, Version 2.0 (the "License"); ~ you may not use this file
+ except in compliance with the License. ~ You may obtain a copy of the License
+ at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by
+ applicable law or agreed to in writing, software ~ distributed under the
+ License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. ~ See the License for the specific
+ language governing permissions and ~ limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.river</groupId>
+ <artifactId>mercury</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.river.mercury</groupId>
+ <artifactId>mercury-service</artifactId>
+ <url>http://river.apache.org</url>
+ <name>Module :: Mercury Service Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.river.mercury</groupId>
+ <artifactId>mercury-dl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.river</groupId>
+ <artifactId>river-logging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.river</groupId>
+ <artifactId>river-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.river</groupId>
+ <artifactId>river-activation</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLog.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLog.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLog.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLog.java Sun Jul 5 11:41:39 2020
@@ -1,153 +1,154 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.river.mercury;
-
-import net.jini.id.Uuid;
-
-import java.io.IOException;
-import java.util.NoSuchElementException;
-
-import net.jini.core.event.RemoteEvent;
-
-/**
- * Interface implemented by event storage objects.
- * This class encapsulates the details of reading/writing events from/to
- * some underlying persistence mechanism.
- *
- * This interface makes certain assumptions. First, the <tt>next</tt> and
- * <tt>remove</tt> methods are intended to be called in pairs. If
- * <tt>remove</tt> is not called, then subsequent calls to <tt>next</tt>
- * will attempt to return the same object. Calling <tt>remove</tt>
- * essentially advances the read pointer to the next object, if any.
- * Second, if any <tt>IOExceptions</tt> are encountered during the reading
- * or writing of an event the associated read/write pointer is advanced
- * past the offending event. This means that events can be lost if I/O
- * errors are encountered.
- *
- * @author Sun Microsystems, Inc.
- *
- * @since 1.1
- */
-
-interface EventLog {
-
- /**
- * Initializes the state of this <tt>EventLog</tt> object.
- * The required functionality can potentially throw an
- * <tt>IOException</tt> and has therefore been separated from
- * from object construction.
- *
- * @exception IOException if an I/O error occurs
- */
- void init() throws IOException;
-
- /**
- * Writes the given <tt>RemoteEvent</tt> to the underlying
- * storage mechanism, if possible. If an <tt>IOException</tt>
- * occurs, then the write cannot be guaranteed.
- *
- * @exception IOException if an I/O error occurs
- */
- void add(RemoteEvent event) throws IOException;
-
- /**
- * Return the next <tt>RemoteEvent</tt> to be read. Note that
- * <tt>next</tt> is meant to be used in conjunction with
- * <tt>remove</tt>. Subsequent calls to <tt>next</tt> will
- * return the same event until <tt>remove</tt> is called, which
- * actually updates the read pointer to the next event (indicating
- * that the previously read event was successfully processed).
- *
- * @exception IOException if an I/O error occurs
- *
- * @exception ClassNotFoundException if a class for the serialized
- * object could not be found
- *
- * @exception NoSuchElementException if no event is available
- */
- RemoteEvent next() throws IOException, ClassNotFoundException;
-
- /**
- * Returns <tt>true</tt> if this log contains no events and
- * false otherwise.
- */
- boolean isEmpty() throws IOException;
-
- /**
- * Effectively removes the last read event from the log.
- * It does this by advancing the read pointer to the
- * next available event, if any.
- *
- * @exception NoSuchElementException if no events are available
- */
- void remove() throws IOException;
-
- /**
- * Return an array of <tt>RemoteEventData</tt> with a limit of
- * <tt>maxEvents</tt> elements. Note that
- * <tt>readAhead</tt> is meant to be used in conjunction with
- * <tt>moveAhead</tt>. Subsequent calls to <tt>readAhead</tt> with
- * the same argument value will return the same set of events until
- * <tt>moveAhead</tt> is called, which
- * actually updates the read pointer to the next unread event (indicating
- * that the previously read events were successfully processed).
- *
- * @param maxEvents maximum number of events/elements to return
- *
- * @exception IOException if an I/O error occurs
- *
- * @exception ClassNotFoundException if a class for the serialized
- * object could not be found
- *
- * @exception NoSuchElementException if no event is available
- */
- RemoteEventData[] readAhead(int maxEvents)
- throws IOException, ClassNotFoundException;
-
- /**
- * Effectively removes the last set of read events from the log.
- * It does this by advancing the read pointer to the
- * next available event after the event associated with the provided
- * cookie object.
- *
- * @param cookie object associated with event to read past. This object
- * should have been obtained from a call to
- * <code>getCookie()</code> on a <code>RemoteEventData</code> object
- * obtained from a call to <code>readAhead</code> on this event log.
- *
- * @exception IOException if there was a problem advancing the read pointer.
- * @exception NullPointerException if <code>cookie</code> is null.
- * @exception ClassCastException if <code>cookie</code>
- * is not an expected type.
- *
- */
- void moveAhead(Object cookie) throws IOException;
-
- /**
- * Close this log and release any associated runtime resources.
- */
- void close() throws IOException;
-
- /**
- * Delete associated storage resources for this log.
- *
- * @exception IOException if an IO error occurs
- */
- void delete() throws IOException;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.mercury;
+
+import net.jini.id.Uuid;
+
+import java.io.IOException;
+import java.util.NoSuchElementException;
+
+import org.apache.river.mercury.proxy.RemoteEventData;
+import net.jini.core.event.RemoteEvent;
+
+/**
+ * Interface implemented by event storage objects.
+ * This class encapsulates the details of reading/writing events from/to
+ * some underlying persistence mechanism.
+ *
+ * This interface makes certain assumptions. First, the <tt>next</tt> and
+ * <tt>remove</tt> methods are intended to be called in pairs. If
+ * <tt>remove</tt> is not called, then subsequent calls to <tt>next</tt>
+ * will attempt to return the same object. Calling <tt>remove</tt>
+ * essentially advances the read pointer to the next object, if any.
+ * Second, if any <tt>IOExceptions</tt> are encountered during the reading
+ * or writing of an event the associated read/write pointer is advanced
+ * past the offending event. This means that events can be lost if I/O
+ * errors are encountered.
+ *
+ * @author Sun Microsystems, Inc.
+ *
+ * @since 1.1
+ */
+
+interface EventLog {
+
+ /**
+ * Initializes the state of this <tt>EventLog</tt> object.
+ * The required functionality can potentially throw an
+ * <tt>IOException</tt> and has therefore been separated from
+ * from object construction.
+ *
+ * @exception IOException if an I/O error occurs
+ */
+ void init() throws IOException;
+
+ /**
+ * Writes the given <tt>RemoteEvent</tt> to the underlying
+ * storage mechanism, if possible. If an <tt>IOException</tt>
+ * occurs, then the write cannot be guaranteed.
+ *
+ * @exception IOException if an I/O error occurs
+ */
+ void add(RemoteEvent event) throws IOException;
+
+ /**
+ * Return the next <tt>RemoteEvent</tt> to be read. Note that
+ * <tt>next</tt> is meant to be used in conjunction with
+ * <tt>remove</tt>. Subsequent calls to <tt>next</tt> will
+ * return the same event until <tt>remove</tt> is called, which
+ * actually updates the read pointer to the next event (indicating
+ * that the previously read event was successfully processed).
+ *
+ * @exception IOException if an I/O error occurs
+ *
+ * @exception ClassNotFoundException if a class for the serialized
+ * object could not be found
+ *
+ * @exception NoSuchElementException if no event is available
+ */
+ RemoteEvent next() throws IOException, ClassNotFoundException;
+
+ /**
+ * Returns <tt>true</tt> if this log contains no events and
+ * false otherwise.
+ */
+ boolean isEmpty() throws IOException;
+
+ /**
+ * Effectively removes the last read event from the log.
+ * It does this by advancing the read pointer to the
+ * next available event, if any.
+ *
+ * @exception NoSuchElementException if no events are available
+ */
+ void remove() throws IOException;
+
+ /**
+ * Return an array of <tt>RemoteEventData</tt> with a limit of
+ * <tt>maxEvents</tt> elements. Note that
+ * <tt>readAhead</tt> is meant to be used in conjunction with
+ * <tt>moveAhead</tt>. Subsequent calls to <tt>readAhead</tt> with
+ * the same argument value will return the same set of events until
+ * <tt>moveAhead</tt> is called, which
+ * actually updates the read pointer to the next unread event (indicating
+ * that the previously read events were successfully processed).
+ *
+ * @param maxEvents maximum number of events/elements to return
+ *
+ * @exception IOException if an I/O error occurs
+ *
+ * @exception ClassNotFoundException if a class for the serialized
+ * object could not be found
+ *
+ * @exception NoSuchElementException if no event is available
+ */
+ RemoteEventData[] readAhead(int maxEvents)
+ throws IOException, ClassNotFoundException;
+
+ /**
+ * Effectively removes the last set of read events from the log.
+ * It does this by advancing the read pointer to the
+ * next available event after the event associated with the provided
+ * cookie object.
+ *
+ * @param cookie object associated with event to read past. This object
+ * should have been obtained from a call to
+ * <code>getCookie()</code> on a <code>RemoteEventData</code> object
+ * obtained from a call to <code>readAhead</code> on this event log.
+ *
+ * @exception IOException if there was a problem advancing the read pointer.
+ * @exception NullPointerException if <code>cookie</code> is null.
+ * @exception ClassCastException if <code>cookie</code>
+ * is not an expected type.
+ *
+ */
+ void moveAhead(Object cookie) throws IOException;
+
+ /**
+ * Close this log and release any associated runtime resources.
+ */
+ void close() throws IOException;
+
+ /**
+ * Delete associated storage resources for this log.
+ *
+ * @exception IOException if an IO error occurs
+ */
+ void delete() throws IOException;
+
+}
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogFactory.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogFactory.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogFactory.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogFactory.java Sun Jul 5 11:41:39 2020
@@ -1,199 +1,202 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.river.mercury;
-
-import net.jini.id.Uuid;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.NoSuchElementException;
-import java.util.LinkedList;
-import java.util.List;
-
-import net.jini.core.event.RemoteEvent;
-
-/**
- * This class serves as a factory for generating <tt>EventLogIterator</tt>
- * objects. The iterator objects are cached so that subsequent calls
- * for the same iterator return the same object.
- *
- * @author Sun Microsystems, Inc.
- *
- * @since 1.1
- */
-class EventLogFactory {
-
- /** <tt>Map</tt> that contains references to generated iterators */
- private HashMap iterators = new HashMap();
-
- /**
- * Method to return the iterator object for the designated
- * <tt>Uuid</tt>. The <tt>File</tt> argument determines where the
- * persistence store will be maintained and is only used for the
- * first instance of the iterator. (Note that upon recovery
- * from a restart/crash the <tt>Uuid</tt> will already exist so the
- * <tt>logPath</tt> arg will not be used.)
- * Subsequent calls for the same <tt>Uuid</tt> will return the
- * original object.
- */
- public EventLogIterator iterator(Uuid uuid, File logPath) {
-
- // Try to get reference from cache
- EventLogIteratorImpl eli = (EventLogIteratorImpl)iterators.get(uuid);
- if (eli == null) { // doesn't exist, so create one
- eli = new EventLogIteratorImpl(uuid, logPath);
- try {
- eli.init(); // initialize the iterator
- } catch (IOException ioe) {
- // ignore ... the next usage of this
- // object will throw IOException
- }
- iterators.put(uuid, eli); // add to cache
- }
-
- return eli;
- }
-
- /**
- * Method to return the iterator object for the designated
- * <tt>Uuid</tt>.
- * Subsequent calls for the same <tt>Uuid</tt> will return the
- * original object.
- */
- public EventLogIterator iterator(Uuid uuid) {
-
- // Try to get reference from cache
- EventLogIteratorImpl eli = (EventLogIteratorImpl)iterators.get(uuid);
- if (eli == null) { // doesn't exist, so create one
- eli = new EventLogIteratorImpl(uuid);
- try {
- eli.init(); // initialize the iterator
- } catch (IOException ioe) {
- throw new InternalMailboxException(
- "Received unexpected IOException from"
- + " a non-persistent log", ioe);
- }
- iterators.put(uuid, eli); // add to cache
- }
-
- return eli;
- }
-
- /**
- * Remove the <TT>EventLogIterator</TT> associated with the given
- * <TT>Uuid</TT>. This is (presumably) called to flush an existing
- * <TT>EventLogIterator</TT> whose storage location has changed.
- * This way, the next call to <TT>iterator</TT> will produce a new
- * object instead of returning the cached version.
- */
- public void remove(Uuid uuid) {
- iterators.remove(uuid); // remove from cache, if it's there
- }
-
- /**
- * Private class which implements the <tt>EventLogIterator</tt>
- * interface. This class delegates to an <tt>EventLog</tt> for most
- * of its functionality.
- */
- private static class EventLogIteratorImpl
- implements EventLogIterator
- {
-
- /** The associated <tt>Uuid</tt> for this iterator */
- private final Uuid uuid;
-
- /** The associated <tt>EventLog</tt> for this iterator */
- private EventLog log = null;
-
- /**
- * Simple constructor that assigns the <tt>Uuid</tt>
- * field to the appropriate internal field and creates
- * a persistent <tt>EventLog</tt> object using the provided
- * <tt>File</tt> argument.
- */
- EventLogIteratorImpl(Uuid id, File logPath) {
- uuid = id;
- log = new PersistentEventLog(id, logPath);
- }
-
- /**
- * Simple constructor that assigns the <tt>Uuid</tt>
- * field to the appropriate internal field and creates
- * a transient event log.
- */
- EventLogIteratorImpl(Uuid id) {
- uuid = id;
- log = new TransientEventLog(id);
- }
-
- // Inherit documentation from supertype
- public void init() throws IOException {
- log.init();
- }
-
- // Inherit documentation from supertype
- public void add(RemoteEvent evt) throws IOException,
- IllegalArgumentException
- {
- log.add(evt);
- }
-
- // Inherit documentation from supertype
- public boolean hasNext() throws IOException {
- return !log.isEmpty();
- }
-
- // Inherit documentation from supertype
- public RemoteEvent next() throws IOException,
- ClassNotFoundException, NoSuchElementException
- {
- return log.next();
- }
-
- // Inherit documentation from supertype
- public void remove() throws IOException, IllegalStateException {
- log.remove();
- }
-
- // Inherit documentation from supertype
- public RemoteEventData[] readAhead(int maxEvents)
- throws IOException, ClassNotFoundException
- {
- return log.readAhead(maxEvents);
- }
-
- // Inherit documentation from supertype
- public void moveAhead(Object cookie) throws IOException {
- log.moveAhead(cookie);
- }
-
- // Inherit documentation from supertype
- public void destroy() throws IOException {
- log.close();
- log.delete();
- }
- }
-}
-
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.mercury;
+
+import net.jini.id.Uuid;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.NoSuchElementException;
+import java.util.LinkedList;
+import java.util.List;
+
+import net.jini.core.event.RemoteEvent;
+import org.apache.river.mercury.proxy.InternalMailboxException;
+import org.apache.river.mercury.proxy.RemoteEventData;
+
+
+/**
+ * This class serves as a factory for generating <tt>EventLogIterator</tt>
+ * objects. The iterator objects are cached so that subsequent calls
+ * for the same iterator return the same object.
+ *
+ * @author Sun Microsystems, Inc.
+ *
+ * @since 1.1
+ */
+class EventLogFactory {
+
+ /** <tt>Map</tt> that contains references to generated iterators */
+ private HashMap iterators = new HashMap();
+
+ /**
+ * Method to return the iterator object for the designated
+ * <tt>Uuid</tt>. The <tt>File</tt> argument determines where the
+ * persistence store will be maintained and is only used for the
+ * first instance of the iterator. (Note that upon recovery
+ * from a restart/crash the <tt>Uuid</tt> will already exist so the
+ * <tt>logPath</tt> arg will not be used.)
+ * Subsequent calls for the same <tt>Uuid</tt> will return the
+ * original object.
+ */
+ public EventLogIterator iterator(Uuid uuid, File logPath) {
+
+ // Try to get reference from cache
+ EventLogIteratorImpl eli = (EventLogIteratorImpl)iterators.get(uuid);
+ if (eli == null) { // doesn't exist, so create one
+ eli = new EventLogIteratorImpl(uuid, logPath);
+ try {
+ eli.init(); // initialize the iterator
+ } catch (IOException ioe) {
+ // ignore ... the next usage of this
+ // object will throw IOException
+ }
+ iterators.put(uuid, eli); // add to cache
+ }
+
+ return eli;
+ }
+
+ /**
+ * Method to return the iterator object for the designated
+ * <tt>Uuid</tt>.
+ * Subsequent calls for the same <tt>Uuid</tt> will return the
+ * original object.
+ */
+ public EventLogIterator iterator(Uuid uuid) {
+
+ // Try to get reference from cache
+ EventLogIteratorImpl eli = (EventLogIteratorImpl)iterators.get(uuid);
+ if (eli == null) { // doesn't exist, so create one
+ eli = new EventLogIteratorImpl(uuid);
+ try {
+ eli.init(); // initialize the iterator
+ } catch (IOException ioe) {
+ throw new InternalMailboxException(
+ "Received unexpected IOException from"
+ + " a non-persistent log", ioe);
+ }
+ iterators.put(uuid, eli); // add to cache
+ }
+
+ return eli;
+ }
+
+ /**
+ * Remove the <TT>EventLogIterator</TT> associated with the given
+ * <TT>Uuid</TT>. This is (presumably) called to flush an existing
+ * <TT>EventLogIterator</TT> whose storage location has changed.
+ * This way, the next call to <TT>iterator</TT> will produce a new
+ * object instead of returning the cached version.
+ */
+ public void remove(Uuid uuid) {
+ iterators.remove(uuid); // remove from cache, if it's there
+ }
+
+ /**
+ * Private class which implements the <tt>EventLogIterator</tt>
+ * interface. This class delegates to an <tt>EventLog</tt> for most
+ * of its functionality.
+ */
+ private static class EventLogIteratorImpl
+ implements EventLogIterator
+ {
+
+ /** The associated <tt>Uuid</tt> for this iterator */
+ private final Uuid uuid;
+
+ /** The associated <tt>EventLog</tt> for this iterator */
+ private EventLog log = null;
+
+ /**
+ * Simple constructor that assigns the <tt>Uuid</tt>
+ * field to the appropriate internal field and creates
+ * a persistent <tt>EventLog</tt> object using the provided
+ * <tt>File</tt> argument.
+ */
+ EventLogIteratorImpl(Uuid id, File logPath) {
+ uuid = id;
+ log = new PersistentEventLog(id, logPath);
+ }
+
+ /**
+ * Simple constructor that assigns the <tt>Uuid</tt>
+ * field to the appropriate internal field and creates
+ * a transient event log.
+ */
+ EventLogIteratorImpl(Uuid id) {
+ uuid = id;
+ log = new TransientEventLog(id);
+ }
+
+ // Inherit documentation from supertype
+ public void init() throws IOException {
+ log.init();
+ }
+
+ // Inherit documentation from supertype
+ public void add(RemoteEvent evt) throws IOException,
+ IllegalArgumentException
+ {
+ log.add(evt);
+ }
+
+ // Inherit documentation from supertype
+ public boolean hasNext() throws IOException {
+ return !log.isEmpty();
+ }
+
+ // Inherit documentation from supertype
+ public RemoteEvent next() throws IOException,
+ ClassNotFoundException, NoSuchElementException
+ {
+ return log.next();
+ }
+
+ // Inherit documentation from supertype
+ public void remove() throws IOException, IllegalStateException {
+ log.remove();
+ }
+
+ // Inherit documentation from supertype
+ public RemoteEventData[] readAhead(int maxEvents)
+ throws IOException, ClassNotFoundException
+ {
+ return log.readAhead(maxEvents);
+ }
+
+ // Inherit documentation from supertype
+ public void moveAhead(Object cookie) throws IOException {
+ log.moveAhead(cookie);
+ }
+
+ // Inherit documentation from supertype
+ public void destroy() throws IOException {
+ log.close();
+ log.delete();
+ }
+ }
+}
+
+
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogIterator.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogIterator.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogIterator.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/EventLogIterator.java Sun Jul 5 11:41:39 2020
@@ -1,117 +1,118 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.river.mercury;
-
-import java.io.IOException;
-import java.util.NoSuchElementException;
-
-import net.jini.core.event.RemoteEvent;
-
-/**
- * <code>EventLogIterator</code> provides an abstraction for accessing
- * the events
- * stored on behalf of a particular registration. The methods closely
- * resemble the <tt>java.util.iterator</tt> interface with the
- * exception of the <code>throws</code> clauses and the additional
- * <tt>destroy</tt> and <tt>add</tt> methods.
- *
- * The semantics for this iterator are the same as <tt>java.util.Iterator</tt>
- * in that <tt>next</tt> and <tt>remove</tt> are intended to be called
- * in pairs.
- *
- * @author Sun Microsystems, Inc.
- *
- * @since 1.1
- */
-interface EventLogIterator {
- /**
- * Store the given <tt>RemoteEvent</tt> event.
- * @throws IOException if an I/O errors occurs
- */
- void add(RemoteEvent re) throws IOException;
-
- /**
- * Return true if there are any events in the collection and
- * false otherwise.
- * @throws IOException if an I/O errors occurs
- */
- boolean hasNext() throws IOException;
-
- /**
- * Return the next event in the collection.
- * @throws IOException if an I/O errors occurs
- * @throws NoSuchElementException if there are no available
- * <code>RemoteEvent</code>s
- * @throws ClassNotFoundException if there was a problem deserializing
- * the stored <code>RemoteEvent</code>
- */
- RemoteEvent next() throws IOException, NoSuchElementException,
- ClassNotFoundException;
-
- /**
- * Remove the event at the iterator's current cursor position.
- * It is expected that the cursor position will be updated to
- * point to the next unread event object, if any, upon return
- * from this method.
- * @throws IOException if an I/O errors occurs
- */
- void remove() throws IOException;
-
- /**
- * Return an array of <tt>RemoteEventData</tt> with a limit of
- * <tt>maxEvents</tt> elements. Note that
- * <tt>readAhead</tt> is meant to be used in conjunction with
- * <tt>moveAhead</tt>. Subsequent calls to <tt>readAhead</tt> with
- * the same argument value will return the same set of events until
- * <tt>moveAhead</tt> is called, which
- * actually updates the read pointer to the next unread event (indicating
- * that the previously read events were successfully processed).
- *
- * @param maxEvents maximum number of events/elements to return
- *
- * @exception IOException if an I/O error occurs
- *
- * @exception ClassNotFoundException if a class for the serialized
- * object could not be found
- *
- * @exception NoSuchElementException if no event is available
- */
- RemoteEventData[] readAhead(int maxEvents)
- throws IOException, ClassNotFoundException;
-
- /**
- * Effectively removes the last set of read events from the log.
- * It does this by advancing the read pointer to the
- * next available event after the event associated with the provided
- * cookie object.
- *
- * @param cookie object associated with event to read past. This object
- * should have been obtained from a previous call to <code>readAhead</code>
- * on this event log.
- *
- * @exception IOException if there was a problem advancing the read pointer.
- */
- void moveAhead(Object cookie) throws IOException;
-
- /**
- * Destroy the collection of stored events.
- * @throws IOException if an I/O errors occurs
- */
- void destroy() throws IOException;
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.mercury;
+
+import java.io.IOException;
+import java.util.NoSuchElementException;
+
+import net.jini.core.event.RemoteEvent;
+import org.apache.river.mercury.proxy.RemoteEventData;
+
+/**
+ * <code>EventLogIterator</code> provides an abstraction for accessing
+ * the events
+ * stored on behalf of a particular registration. The methods closely
+ * resemble the <tt>java.util.iterator</tt> interface with the
+ * exception of the <code>throws</code> clauses and the additional
+ * <tt>destroy</tt> and <tt>add</tt> methods.
+ *
+ * The semantics for this iterator are the same as <tt>java.util.Iterator</tt>
+ * in that <tt>next</tt> and <tt>remove</tt> are intended to be called
+ * in pairs.
+ *
+ * @author Sun Microsystems, Inc.
+ *
+ * @since 1.1
+ */
+interface EventLogIterator {
+ /**
+ * Store the given <tt>RemoteEvent</tt> event.
+ * @throws IOException if an I/O errors occurs
+ */
+ void add(RemoteEvent re) throws IOException;
+
+ /**
+ * Return true if there are any events in the collection and
+ * false otherwise.
+ * @throws IOException if an I/O errors occurs
+ */
+ boolean hasNext() throws IOException;
+
+ /**
+ * Return the next event in the collection.
+ * @throws IOException if an I/O errors occurs
+ * @throws NoSuchElementException if there are no available
+ * <code>RemoteEvent</code>s
+ * @throws ClassNotFoundException if there was a problem deserializing
+ * the stored <code>RemoteEvent</code>
+ */
+ RemoteEvent next() throws IOException, NoSuchElementException,
+ ClassNotFoundException;
+
+ /**
+ * Remove the event at the iterator's current cursor position.
+ * It is expected that the cursor position will be updated to
+ * point to the next unread event object, if any, upon return
+ * from this method.
+ * @throws IOException if an I/O errors occurs
+ */
+ void remove() throws IOException;
+
+ /**
+ * Return an array of <tt>RemoteEventData</tt> with a limit of
+ * <tt>maxEvents</tt> elements. Note that
+ * <tt>readAhead</tt> is meant to be used in conjunction with
+ * <tt>moveAhead</tt>. Subsequent calls to <tt>readAhead</tt> with
+ * the same argument value will return the same set of events until
+ * <tt>moveAhead</tt> is called, which
+ * actually updates the read pointer to the next unread event (indicating
+ * that the previously read events were successfully processed).
+ *
+ * @param maxEvents maximum number of events/elements to return
+ *
+ * @exception IOException if an I/O error occurs
+ *
+ * @exception ClassNotFoundException if a class for the serialized
+ * object could not be found
+ *
+ * @exception NoSuchElementException if no event is available
+ */
+ RemoteEventData[] readAhead(int maxEvents)
+ throws IOException, ClassNotFoundException;
+
+ /**
+ * Effectively removes the last set of read events from the log.
+ * It does this by advancing the read pointer to the
+ * next available event after the event associated with the provided
+ * cookie object.
+ *
+ * @param cookie object associated with event to read past. This object
+ * should have been obtained from a previous call to <code>readAhead</code>
+ * on this event log.
+ *
+ * @exception IOException if there was a problem advancing the read pointer.
+ */
+ void moveAhead(Object cookie) throws IOException;
+
+ /**
+ * Destroy the collection of stored events.
+ * @throws IOException if an I/O errors occurs
+ */
+ void destroy() throws IOException;
+}
+
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/MailboxImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/MailboxImpl.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/MailboxImpl.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/MailboxImpl.java Sun Jul 5 11:41:39 2020
@@ -18,6 +18,9 @@
package org.apache.river.mercury;
+import org.apache.river.mercury.proxy.ListenerProxy;
+import org.apache.river.mercury.proxy.Registration;
+
import org.apache.river.config.Config;
import org.apache.river.constants.TimeConstants;
import org.apache.river.constants.ThrowableConstants;
@@ -35,14 +38,14 @@ import org.apache.river.proxy.ThrowThis;
import org.apache.river.reliableLog.ReliableLog;
import org.apache.river.reliableLog.LogException;
import org.apache.river.reliableLog.LogHandler;
-import org.apache.river.start.LifeCycle;
+import org.apache.river.start.lifecycle.LifeCycle;
import org.apache.river.api.util.Startable;
import org.apache.river.thread.InterruptedStatusThread;
import org.apache.river.thread.ReadersWriter;
import org.apache.river.thread.ReadersWriter.ConcurrentLockException;
import org.apache.river.thread.ReadyState;
-import org.apache.river.thread.RetryTask;
-import org.apache.river.thread.WakeupManager;
+import org.apache.river.thread.wakeup.RetryTask;
+import org.apache.river.thread.wakeup.WakeupManager;
import net.jini.config.Configuration;
import net.jini.config.ConfigurationProvider;
import net.jini.config.ConfigurationException;
@@ -55,6 +58,7 @@ import net.jini.id.UuidFactory;
import net.jini.security.ProxyPreparer;
import net.jini.security.proxytrust.ServerProxyTrust;
import net.jini.security.TrustVerifier;
+import org.apache.river.mercury.proxy.InternalMailboxException;
import java.io.File;
import java.io.InputStream;
@@ -121,6 +125,15 @@ import net.jini.discovery.LookupDiscover
import net.jini.io.MarshalledInstance;
import org.apache.river.thread.NamedThreadFactory;
+import org.apache.river.mercury.proxy.MailboxBackEnd;
+import org.apache.river.mercury.proxy.MailboxProxy;
+import org.apache.river.mercury.proxy.MailboxAdminProxy;
+import org.apache.river.mercury.proxy.RemoteEventIteratorData;
+import org.apache.river.mercury.proxy.ProxyVerifier;
+import org.apache.river.mercury.proxy.RemoteEventData;
+
+
+
/**
* <tt>MailboxImpl</tt> implements the server side of the event
* mailbox service.
Modified: river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/NonActivatableMercuryImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/NonActivatableMercuryImpl.java?rev=1879521&r1=1879520&r2=1879521&view=diff
==============================================================================
--- river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/NonActivatableMercuryImpl.java (original)
+++ river/jtsk/modules/modularize/apache-river/river-services/mercury/mercury-service/src/main/java/org/apache/river/mercury/NonActivatableMercuryImpl.java Sun Jul 5 11:41:39 2020
@@ -1,56 +1,56 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.river.mercury;
-
-import org.apache.river.start.LifeCycle;
-
-/**
- * Convenience class intended for use with the
- * {@link org.apache.river.start.ServiceStarter} framework to start
- * an implementation of Mercury that is not activatable, but which
- * will log its state information to persistent storage.
- *
- * @author Sun Microsystems, Inc.
- * @since 2.0
- */
-class NonActivatableMercuryImpl extends MailboxImpl {
-
- /**
- * Constructs a new instance of <code>MailboxImpl</code> that is not
- * activatable, but which will persist its state.
- *
- * @param configArgs <code>String</code> array whose elements are
- * the arguments to use when creating the server.
- * @param lifeCycle instance of <code>LifeCycle</code> that, if
- * non-<code>null</code>, will cause this object's
- * <code>unregister</code> method to be invoked during
- * shutdown to notify the service starter framework that
- * the reference to this service's implementation can be
- * 'released' for garbage collection. A value of
- * <code>null</code> for this argument is allowed.
- *
- * @throws Exception If there was a problem initializing the service.
- */
- NonActivatableMercuryImpl(String[] configArgs, LifeCycle lifeCycle)
- throws Exception
- {
- super(configArgs, lifeCycle, true);//true ==> persistent
- }//end constructor
-
-}//end class NonActivatableMercuryImpl
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.mercury;
+
+import org.apache.river.start.lifecycle.LifeCycle;
+
+/**
+ * Convenience class intended for use with the
+ * {@link org.apache.river.start.ServiceStarter} framework to start
+ * an implementation of Mercury that is not activatable, but which
+ * will log its state information to persistent storage.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 2.0
+ */
+class NonActivatableMercuryImpl extends MailboxImpl {
+
+ /**
+ * Constructs a new instance of <code>MailboxImpl</code> that is not
+ * activatable, but which will persist its state.
+ *
+ * @param configArgs <code>String</code> array whose elements are
+ * the arguments to use when creating the server.
+ * @param lifeCycle instance of <code>LifeCycle</code> that, if
+ * non-<code>null</code>, will cause this object's
+ * <code>unregister</code> method to be invoked during
+ * shutdown to notify the service starter framework that
+ * the reference to this service's implementation can be
+ * 'released' for garbage collection. A value of
+ * <code>null</code> for this argument is allowed.
+ *
+ * @throws Exception If there was a problem initializing the service.
+ */
+ NonActivatableMercuryImpl(String[] configArgs, LifeCycle lifeCycle)
+ throws Exception
+ {
+ super(configArgs, lifeCycle, true);//true ==> persistent
+ }//end constructor
+
+}//end class NonActivatableMercuryImpl
+