1 28 29 30 package org.objectweb.ccm.runtime; 31 32 import org.objectweb.corba.runtime.*; 33 34 37 public class SlotImpl 38 extends org.omg.CORBA.LocalObject 39 implements org.coach.ECA.Slot 40 { 41 private java.util.Hashtable _values; private int _slot_id; 44 private String _slot_id_str; 45 46 public 48 SlotImpl(java.util.Hashtable values, int sid) 49 { 50 _values = values; 52 _slot_id = sid; 53 _slot_id_str = Integer.toString(sid); 54 } 55 56 60 private java.util.Hashtable 61 getStorageForThread(String tname) 62 { 63 java.util.Hashtable table = (java.util.Hashtable )_values.get(tname); 64 if (table==null) { 65 table = new java.util.Hashtable (); 66 _values.put(tname, table); 67 } 68 69 return table; 70 } 71 72 private org.omg.CORBA.Any 73 getValue(String tname, String key) 74 { 75 String rkey = _slot_id_str + key; 76 return (org.omg.CORBA.Any )getStorageForThread(tname).get(rkey); 77 } 78 79 private void 80 putValue(String tname, String key, org.omg.CORBA.Any value) 81 { 82 String rkey = _slot_id_str + key; 83 getStorageForThread(tname).put(rkey, value); 84 } 85 86 90 final public void 91 put(String key, org.omg.CORBA.Any value) 92 { 93 putValue(Thread.currentThread().getName(), key, value); 94 } 95 96 final public org.omg.CORBA.Any 97 get(String key) 98 { 99 return getValue(Thread.currentThread().getName(), key); 100 } 101 } 102 | Popular Tags |