1 26 27 package DiningPhilosophers.monolithic; 28 29 import DiningPhilosophers.*; 30 31 47 48 public class ForkManagerImpl 49 extends org.omg.CORBA.LocalObject 50 implements CCM_ForkManager, 51 CCM_Fork, 52 org.omg.Components.SessionComponent 53 { 54 60 61 private boolean available_; 62 63 64 private CCM_ForkManager_Context the_context_; 65 66 72 73 public 74 ForkManagerImpl() 75 { 76 available_ = true; 77 } 78 79 85 91 97 103 public void 104 configuration_complete() 105 throws org.omg.Components.InvalidConfiguration 106 { 107 } 109 110 116 121 public void 122 set_session_context(org.omg.Components.SessionContext context) 123 throws org.omg.Components.CCMException 124 { 125 the_context_ = (CCM_ForkManager_Context)context; 126 } 127 128 133 public void 134 ccm_activate() 135 throws org.omg.Components.CCMException 136 { 137 } 139 140 145 public void 146 ccm_passivate() 147 throws org.omg.Components.CCMException 148 { 149 } 151 152 157 public void 158 ccm_remove() 159 throws org.omg.Components.CCMException 160 { 161 } 163 164 170 174 public CCM_Fork 175 get_the_fork() 176 { 177 return this; 179 } 180 181 187 193 public void 194 get() 195 throws InUse 196 { 197 if (! available_) 199 { 200 throw new InUse(); 201 } 202 203 available_ = false; 205 } 206 207 210 public void 211 release() 212 { 213 if (available_) 215 { 216 return; 217 } 218 219 available_ = true; 221 } 222 } 223 | Popular Tags |