Commit d0eb30db authored by Nicolas Tachker's avatar Nicolas Tachker

JORAM-28 : remove readBag and writeBag only use by HA.

parent b532c975
/*
* Copyright (C) 2004 - France Telecom R&D
* Copyright (C) 2004 ScalAgent Distributed Technologies
*
* This library 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 any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package fr.dyade.aaa.agent;
import java.io.*;
/**
* This interface is used by object that need to carry additionnal data
* between HA nodes.
*/
public interface BagSerializer {
/**
* The readBag method is responsible for reading from the stream and
* restoring the agent's transient state.
*/
public void readBag(ObjectInputStream in)
throws IOException, ClassNotFoundException;
/**
* The writeBag method is responsible for writing the extra data
* of this particular agent so that the corresponding readBag method
* can restore it.
*/
public void writeBag(ObjectOutputStream out)
throws IOException;
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2008 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2012 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -343,18 +343,4 @@ public class ContextManager
registerMBean(context, cn);
}
}
public void writeBag(ObjectOutputStream out)
throws IOException {
out.writeObject(contextIdTable);
out.writeObject(contextNameTable);
storageManager.writeBag(out);
}
public void readBag(ObjectInputStream in)
throws IOException, ClassNotFoundException {
contextIdTable = (ContextTable)in.readObject();
contextNameTable = (ContextTable)in.readObject();
storageManager.readBag(in);
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2008 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2012 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -23,10 +23,6 @@
*/
package fr.dyade.aaa.jndi2.impl;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import javax.naming.Binding;
import javax.naming.CompositeName;
import javax.naming.ContextNotEmptyException;
......@@ -619,16 +615,6 @@ public class ServerImpl {
throws NamingException {
contextManager.resetNamingContext(context);
}
public void writeBag(ObjectOutputStream out)
throws IOException {
contextManager.writeBag(out);
}
public void readBag(ObjectInputStream in)
throws IOException, ClassNotFoundException {
contextManager.readBag(in);
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2008 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2012 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -23,8 +23,6 @@
package fr.dyade.aaa.jndi2.impl;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Enumeration;
import java.util.Hashtable;
......@@ -204,16 +202,4 @@ public class StorageManager {
public NamingContextId getIdFromName(CompositeName name) {
return (NamingContextId)nameToIdIndex.get(name);
}
public void writeBag(ObjectOutputStream out)
throws IOException {
out.writeLong(contextCounter);
out.writeObject(nameToIdIndex);
}
public void readBag(ObjectInputStream in)
throws IOException, ClassNotFoundException {
contextCounter = in.readLong();
nameToIdIndex = (Hashtable)in.readObject();
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2012 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -22,19 +22,15 @@
*/
package fr.dyade.aaa.jndi2.server;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Vector;
import org.objectweb.util.monolog.api.BasicLevel;
import fr.dyade.aaa.agent.Agent;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.BagSerializer;
import fr.dyade.aaa.agent.Notification;
public class Container extends Agent implements BagSerializer {
public class Container extends Agent {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 1L;
......@@ -42,8 +38,6 @@ public class Container extends Agent implements BagSerializer {
private LifeCycleListener lifeCycleListener;
private BagSerializer bagSerializer;
/**
* This agent cannot be swapped and has
* a reserved identifier on each agent server.
......@@ -61,10 +55,6 @@ public class Container extends Agent implements BagSerializer {
this.lifeCycleListener = lifeCycleListener;
}
public void setBagSerializer(BagSerializer bagSerializer) {
this.bagSerializer = bagSerializer;
}
public void react(AgentId from, Notification not) throws Exception {
if (Trace.logger.isLoggable(BasicLevel.DEBUG))
Trace.logger.log(BasicLevel.DEBUG, "\n\nJndiServer[" + getId() + "].react(" + from + ',' + not + ')');
......@@ -92,14 +82,4 @@ public class Container extends Agent implements BagSerializer {
void sendNotification(AgentId to, Notification not) {
sendTo(to, not);
}
public void writeBag(ObjectOutputStream out) throws IOException {
if (bagSerializer != null)
bagSerializer.writeBag(out);
}
public void readBag(ObjectInputStream in) throws IOException, ClassNotFoundException {
if (bagSerializer != null)
bagSerializer.readBag(in);
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2008 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2012 ScalAgent Distributed Technologies
* Copyright (C) 1996 - Dyade
*
* This library is free software; you can redistribute it and/or
......@@ -22,9 +22,6 @@
*/
package fr.dyade.aaa.jndi2.server;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import javax.naming.Binding;
......@@ -335,18 +332,4 @@ public class RequestManager implements LifeCycleListener, Serializable {
mre + ',' + reqCtx + ')');
return new JndiError(mre.getNameNotFoundException());
}
public void writeBag(ObjectOutputStream out)
throws IOException {
impl.writeBag(out);
}
public void readBag(ObjectInputStream in)
throws IOException, ClassNotFoundException {
impl = new ServerImpl(
AgentServer.getTransaction(),
getId(),
getRootOwnerId());
impl.readBag(in);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment