1 29 30 package com.caucho.quercus.env; 31 32 import com.caucho.quercus.QuercusModuleException; 33 import com.caucho.quercus.lib.UnserializeReader; 34 import com.caucho.server.cluster.ClusterObject; 35 import com.caucho.util.CacheListener; 36 37 import java.io.IOException ; 38 import java.io.ObjectInputStream ; 39 import java.io.ObjectOutputStream ; 40 import java.util.IdentityHashMap ; 41 import java.util.Map ; 42 import java.util.logging.Level ; 43 import java.util.logging.Logger ; 44 45 48 public class ResinSessionArrayValue extends SessionArrayValue 49 { 50 static protected final Logger log 51 = Logger.getLogger(ResinSessionArrayValue.class.getName()); 52 53 private ClusterObject _clusterObject; 54 55 public ResinSessionArrayValue(String id, long now, 56 long maxInactiveInterval) 57 { 58 super(id, now, maxInactiveInterval); 59 } 60 61 public ResinSessionArrayValue(String id, long now, 62 long maxInactiveInterval, ArrayValue array) 63 { 64 super(id, now, maxInactiveInterval, array); 65 } 66 67 public void setClusterObject(ClusterObject obj) 68 { 69 _clusterObject = obj; 70 } 71 72 75 @Override 76 public Value copy(Env env, IdentityHashMap <Value,Value> map) 77 { 78 long accessTime = _accessTime; 79 80 ResinSessionArrayValue copy = 81 new ResinSessionArrayValue(getId(), accessTime, getMaxInactiveInterval(), 82 (ArrayValue) getArray().copy(env, map)); 83 84 copy.setClusterObject(_clusterObject); 85 86 return copy; 87 } 88 89 @Override 90 public boolean load() 91 { 92 if (_clusterObject != null) 93 return _clusterObject.load(this); 94 else 95 return true; 96 } 97 98 protected void store() 99 { 100 try { 101 ClusterObject clusterObject = _clusterObject; 102 103 if (clusterObject != null) { 104 clusterObject.change(); 107 108 clusterObject.store(this); 109 } 110 } catch (Exception e) { 111 log.log(Level.WARNING, "Can't serialize session", e); 112 } 113 } 114 115 118 @Override 119 protected void remove() 120 { 121 ClusterObject clusterObject = _clusterObject; 122 _clusterObject = null; 123 124 if (clusterObject != null) 125 clusterObject.remove(); 126 } 127 } 128 | Popular Tags |