001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.server.cluster;
030:
031: import com.caucho.log.Log;
032: import com.caucho.util.L10N;
033: import com.caucho.util.LruCache;
034:
035: import java.util.ArrayList;
036: import java.util.logging.Logger;
037:
038: /**
039: * Manages sessions in a web-app.
040: */
041: public class DistributionManager {
042: static protected L10N L = new L10N(DistributionManager.class);
043: static protected final Logger log = Log
044: .open(DistributionManager.class);
045:
046: // factory for creating objects
047: // private ObjectFactory objectFactory;
048:
049: // cached objects
050: private LruCache _objects;
051:
052: private Store _store;
053: private boolean _reloadEachRequest;
054: private boolean _alwaysSave;
055: private boolean _saveOnShutdown;
056:
057: // List of activation listeners
058: private ArrayList _activationListeners;
059:
060: // If true, serialization errors should not be logged
061: private boolean _ignoreSerializationErrors = false;
062:
063: // private Srun []_sessionGroup;
064:
065: private boolean _isClosed;
066:
067: /**
068: * Creates and initializes a new distribution manager
069: */
070: public DistributionManager(Store store) throws Exception {
071: }
072:
073: /**
074: * Returns the debug log
075: */
076: public Logger getDebug() {
077: return log;
078: }
079:
080: /**
081: * Returns the underlying session store of the session manager.
082: */
083: Store getStore() {
084: return _store;
085: }
086:
087: /**
088: * True if the objects should always be saved.
089: */
090: boolean getAlwaysSave() {
091: return _alwaysSave;
092: }
093:
094: /**
095: * True if sessions should only be saved on shutdown.
096: */
097: boolean getSaveOnShutdown() {
098: return _saveOnShutdown;
099: }
100:
101: /**
102: * True if serialization errors should just fail silently.
103: */
104: boolean getIgnoreSerializationErrors() {
105: return _ignoreSerializationErrors;
106: }
107:
108: /**
109: * Returns true if the sessions are closed.
110: */
111: public boolean isClosed() {
112: return _isClosed;
113: }
114: }
|