01: /* ****************************************************************************
02: * SessionBindingMap.java
03: * ****************************************************************************/
04:
05: /* J_LZ_COPYRIGHT_BEGIN *******************************************************
06: * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
07: * Use is subject to license terms. *
08: * J_LZ_COPYRIGHT_END *********************************************************/
09:
10: package org.openlaszlo.data;
11:
12: import java.util.*;
13: import javax.servlet.http.*;
14: import org.openlaszlo.servlets.responders.ResponderCache;
15: import org.apache.log4j.Logger;
16:
17: /**
18: *
19: */
20: public class SessionBindingMap extends HashMap implements
21: HttpSessionBindingListener {
22:
23: private static Logger mLogger = Logger
24: .getLogger(SessionBindingMap.class);
25:
26: public void valueBound(HttpSessionBindingEvent event) {
27: if (mLogger.isDebugEnabled()) {
28: mLogger.debug(
29: /* (non-Javadoc)
30: * @i18n.test
31: * @org-mes=p[0] + " bound for session " + p[1]
32: */
33: org.openlaszlo.i18n.LaszloMessages
34: .getMessage(SessionBindingMap.class.getName(),
35: "051018-32",
36: new Object[] { event.getName(),
37: event.getSession() }));
38: }
39: JavaDataSource.mSessionCounter.increment();
40: }
41:
42: public void valueUnbound(HttpSessionBindingEvent event) {
43: if (mLogger.isDebugEnabled()) {
44: mLogger.debug(
45: /* (non-Javadoc)
46: * @i18n.test
47: * @org-mes=p[0] + " unbound for session " + p[1]
48: */
49: org.openlaszlo.i18n.LaszloMessages
50: .getMessage(SessionBindingMap.class.getName(),
51: "051018-44",
52: new Object[] { event.getName(),
53: event.getSession() }));
54: }
55: JavaDataSource.mSessionCounter.decrement();
56:
57: // decrement number of objects stored by this session.
58: Map m = (Map) event.getValue();
59: JavaDataSource.mSessionObjectsCounter.decrement(m.size());
60: }
61: }
|