Author: david.lloyd(a)jboss.com
Date: 2008-10-07 18:57:23 -0400 (Tue, 07 Oct 2008)
New Revision: 4596
Added:
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientExternalizer.java
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceExternalizer.java
Modified:
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceImpl.java
Log:
Separated externalizers for Remoting elements
Added: remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientExternalizer.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientExternalizer.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientExternalizer.java 2008-10-07
22:57:23 UTC (rev 4596)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting.core;
+
+import org.jboss.marshalling.Externalizer;
+import org.jboss.marshalling.Creator;
+import org.jboss.remoting.spi.remote.RequestHandler;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
+/**
+ *
+ */
+public final class ClientExternalizer implements Externalizer {
+
+ private static final long serialVersionUID = 814228455390899997L;
+
+ private final EndpointImpl endpoint;
+
+ ClientExternalizer(final EndpointImpl endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void writeExternal(final Object o, final ObjectOutput output) throws
IOException {
+ output.writeObject(((ClientImpl)o).getRequestHandlerHandle().getResource());
+ }
+
+ public Object createExternal(final Class<?> aClass, final ObjectInput input,
final Creator creator) throws IOException, ClassNotFoundException {
+ final RequestHandler handler = (RequestHandler) input.readObject();
+ return new ClientImpl(handler.getHandle(), endpoint.getExecutor());
+ }
+
+ public void readExternal(final Object o, final ObjectInput input) throws IOException,
ClassNotFoundException {
+ // no op
+ }
+}
Modified: remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java 2008-10-07
03:06:01 UTC (rev 4595)
+++ remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java 2008-10-07
22:57:23 UTC (rev 4596)
@@ -93,27 +93,7 @@
return "client instance <" + Integer.toString(hashCode()) +
">";
}
- static final class ExternalizerImpl implements Externalizer {
-
- private static final long serialVersionUID = 814228455390899997L;
-
- private final EndpointImpl endpoint;
-
- ExternalizerImpl(final EndpointImpl endpoint) {
- this.endpoint = endpoint;
- }
-
- public void writeExternal(final Object o, final ObjectOutput output) throws
IOException {
- output.writeObject(((ClientImpl)o).handle.getResource());
- }
-
- public Object createExternal(final Class<?> aClass, final ObjectInput
input, final Creator creator) throws IOException, ClassNotFoundException {
- final RequestHandler handler = (RequestHandler) input.readObject();
- return new ClientImpl(handler.getHandle(), endpoint.getExecutor());
- }
-
- public void readExternal(final Object o, final ObjectInput input) throws
IOException, ClassNotFoundException {
- // no op
- }
+ Handle<RequestHandler> getRequestHandlerHandle() {
+ return handle;
}
}
Added:
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceExternalizer.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceExternalizer.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceExternalizer.java 2008-10-07
22:57:23 UTC (rev 4596)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting.core;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.jboss.marshalling.Creator;
+import org.jboss.marshalling.Externalizer;
+import org.jboss.remoting.spi.remote.RequestHandlerSource;
+
+/**
+ *
+ */
+public final class ClientSourceExternalizer implements Externalizer {
+
+ private static final long serialVersionUID = 814228455390899997L;
+
+ private final EndpointImpl endpoint;
+
+ ClientSourceExternalizer(final EndpointImpl endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void writeExternal(final Object o, final ObjectOutput output) throws
IOException {
+ output.writeObject(((ClientSourceImpl)
o).getRequestHandlerSourceHandle().getResource());
+ }
+
+ public Object createExternal(final Class<?> aClass, final ObjectInput input,
final Creator creator) throws IOException, ClassNotFoundException {
+ final RequestHandlerSource handler = (RequestHandlerSource) input.readObject();
+ return new ClientSourceImpl(handler.getHandle(), endpoint);
+ }
+
+ public void readExternal(final Object o, final ObjectInput input) throws IOException,
ClassNotFoundException {
+ // no op
+ }
+}
\ No newline at end of file
Modified:
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceImpl.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceImpl.java 2008-10-07
03:06:01 UTC (rev 4595)
+++
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientSourceImpl.java 2008-10-07
22:57:23 UTC (rev 4596)
@@ -66,4 +66,8 @@
public String toString() {
return "client source instance <" + Integer.toString(hashCode()) +
">";
}
+
+ Handle<RequestHandlerSource> getRequestHandlerSourceHandle() {
+ return handle;
+ }
}