KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > data > SessionBindingMap


1 /* ****************************************************************************
2  * SessionBindingMap.java
3  * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
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
21     implements HttpSessionBindingListener {
22
23     private static Logger mLogger = Logger.getLogger(SessionBindingMap.class);
24
25     public void valueBound(HttpSessionBindingEvent event) {
26         if (mLogger.isDebugEnabled()) {
27             mLogger.debug(event.getName() + " bound for session " +
28                           event.getSession());
29         }
30         JavaDataSource.mSessionCounter.increment();
31     }
32     public void valueUnbound(HttpSessionBindingEvent event) {
33         if (mLogger.isDebugEnabled()) {
34             mLogger.debug(event.getName() + " unbound for session " +
35                           event.getSession());
36         }
37         JavaDataSource.mSessionCounter.decrement();
38
39         // decrement number of objects stored by this session.
40
Map m = (Map)event.getValue();
41         JavaDataSource.mSessionObjectsCounter.decrement(m.size());
42     }
43 }
44
45
Popular Tags