Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerSession.java')
-rw-r--r--plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerSession.java111
1 files changed, 0 insertions, 111 deletions
diff --git a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerSession.java b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerSession.java
deleted file mode 100644
index 98fafa6dcb..0000000000
--- a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerSession.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.jms.internal.server;
-
-import org.eclipse.net4j.internal.jms.DestinationImpl;
-import org.eclipse.net4j.internal.jms.MessageImpl;
-import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.jms.internal.server.bundle.OM;
-import org.eclipse.net4j.jms.server.ISession;
-import org.eclipse.net4j.jms.server.IStore;
-import org.eclipse.net4j.jms.server.IStoreTransaction;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author Eike Stepper
- */
-public class ServerSession extends Lifecycle implements ISession
-{
- private ServerConnection connection;
-
- private int id;
-
- private ConcurrentMap<Long, ServerConsumer> consumers = new ConcurrentHashMap<Long, ServerConsumer>();
-
- public ServerSession(ServerConnection connection, int id)
- {
- this.connection = connection;
- this.id = id;
- }
-
- public ServerConnection getConnection()
- {
- return connection;
- }
-
- public int getID()
- {
- return id;
- }
-
- public long registerConsumer(DestinationImpl dest, String messageSelector, boolean noLocal, boolean durable)
- {
- Server server = connection.getServer();
- String name = dest.getName();
- ServerDestination destination = server.getDestination(name);
- if (destination == null)
- {
- OM.LOG.error("Destination not found: " + name);
- return -1;
- }
-
- ServerConsumer consumer = server.createConsumer(destination, messageSelector, noLocal, durable);
- consumer.setSession(this);
- consumers.put(consumer.getID(), consumer);
- destination.addConsumer(consumer);
- return consumer.getID();
- }
-
- public void handleAcknowledge()
- {
- IStore store = connection.getServer().getStore();
- IStoreTransaction transaction = store.startTransaction();
- handleAcknowledgeInTransaction(transaction);
- store.commitTransaction(transaction);
- }
-
- public void handleAcknowledgeInTransaction(IStoreTransaction transaction)
- {
- for (ServerConsumer consumer : consumers.values())
- {
- consumer.handleAcknowledge(transaction);
- }
- }
-
- public void handleRecover()
- {
- IStore store = connection.getServer().getStore();
- IStoreTransaction transaction = store.startTransaction();
- Collection<ServerConsumer> values = consumers.values();
- for (ServerConsumer consumer : values)
- {
- consumer.handleRecover(transaction);
- }
-
- store.commitTransaction(transaction);
- }
-
- public String[] handleCommit(MessageImpl[] messages)
- {
- Server server = connection.getServer();
- IStore store = server.getStore();
-
- IStoreTransaction transaction = store.startTransaction();
- handleAcknowledgeInTransaction(transaction);
- String[] messageIDs = server.handleClientMessagesInTransaction(transaction, messages);
- store.commitTransaction(transaction);
-
- return messageIDs;
- }
-}

Back to the top