KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > connectors > ResourceAdapterAdminServiceImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.connectors;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.Hashtable JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.Set JavaDoc;
30 import java.util.logging.*;
31 import javax.naming.*;
32 import com.sun.enterprise.connectors.util.*;
33 import com.sun.enterprise.deployment.*;
34 import com.sun.enterprise.deployment.util.*;
35 import com.sun.enterprise.server.*;
36 import com.sun.enterprise.*;
37 import com.sun.enterprise.config.serverbeans.*;
38 import com.sun.enterprise.config.*;
39 import com.sun.enterprise.util.ConnectorClassLoader;
40
41
42 /**
43  * This is resource adapter admin service. It creates, deletes Resource adapter
44  * and also the resource adapter configuration updation.
45  *
46  * @author Binod P.G, Srikanth P and Aditya Gore
47  */

48
49 public class ResourceAdapterAdminServiceImpl
50     extends ConnectorServiceImpl
51     implements ConnectorAdminService {
52
53     private JmsRaMapping ramap= null;
54
55     private int resource_adapter_shutdown_timeout = 0;
56
57     //Resource-Adapter-Name vs Boolean(shutdownStatus)
58
private final Hashtable JavaDoc raShutdownStatusTable = new Hashtable JavaDoc();
59     
60     /**
61      * Default constructor
62      */

63
64     public ResourceAdapterAdminServiceImpl() {
65         super();
66         ramap= new JmsRaMapping();
67     }
68
69
70     /**
71      * Destroys/deletes the Active resource adapter object from the connector
72      * container. Active resource adapter abstracts the rar deployed. It checks
73      * whether any resources (pools and connector resources) are still present.
74      * If they are present the deletion fails and all the objects and
75      * datastructures pertaining to to the resource adapter are left untouched.
76      *
77      * @param moduleName
78      * Name of the rarModule to destroy/delete
79      * @throws ConnectorRuntimeException
80      * if the deletion fails
81      */

82
83     public void destroyActiveResourceAdapter(String JavaDoc moduleName)
84         throws ConnectorRuntimeException {
85         destroyActiveResourceAdapter(moduleName, false);
86
87     }
88
89     /**
90      * Destroys/deletes the Active resource adapter object from the connector
91      * container. Active resource adapter abstracts the rar deployed. It checks
92      * whether any resources (pools and connector resources) are still present.
93      * If they are present and cascade option is false the deletion fails and
94      * all the objects and datastructures pertaining to the resource adapter
95      * are left untouched. If cascade option is true, even if resources are
96      * still present, they are also destroyed with the active resource adapter
97      *
98      * @param moduleName
99      * Name of the rarModule to destroy/delete
100      * @param cascade
101      * If true all the resources belonging to the rar are destroyed
102      * recursively. If false, and if resources pertaining to
103      * resource adapter /rar are present deletetion is failed. Then
104      * cascade should be set to true or all the resources have to
105      * deleted explicitly before destroying the rar/Active resource
106      * adapter.
107      * @throws ConnectorRuntimeException
108      * if the deletion fails
109      */

110
111     public void destroyActiveResourceAdapter(
112         String JavaDoc moduleName,
113         boolean cascade)
114         throws ConnectorRuntimeException {
115
116         ResourcesUtil resutil= ResourcesUtil.getInstance();
117         if (resutil == null) {
118             ConnectorRuntimeException cre=
119                 new ConnectorRuntimeException("Failed to get ResourcesUtil object");
120             _logger.log(Level.SEVERE, "resourcesutil_get_failure", moduleName);
121             _logger.log(Level.SEVERE, "", cre);
122             throw cre;
123         }
124         Object JavaDoc[][] resources= null;
125         try {
126             resources= resutil.getAllConnectorResources(moduleName);
127         } catch (ConfigException ce) {
128             ConnectorRuntimeException cre=
129                 new ConnectorRuntimeException("Failed to get Resources from domain.xml");
130             ce.initCause(ce);
131             _logger.log(
132                 Level.SEVERE,
133                 "rardeployment.resources_list_error",
134                 cre);
135             throw cre;
136         }
137
138         boolean errrorOccured= false;
139
140         com.sun.enterprise.config.serverbeans.ConnectorConnectionPool ccp= null;
141         if (cascade == true && resources != null) {
142             for (int i= 0;
143                 resources[0] != null && i < resources[0].length;
144                 ++i) {
145                 ccp=
146                     (com
147
                        .sun
148                         .enterprise
149                         .config
150                         .serverbeans
151                         .ConnectorConnectionPool) resources[0][i];
152                 try {
153                     _runtime.deleteConnectorConnectionPool(
154                         ccp.getName(),
155                         cascade);
156                 } catch (ConnectorRuntimeException cre) {
157                     errrorOccured= true;
158                 }
159             }
160             for (int i= 0;
161                 resources[2] != null && i < resources[2].length;
162                 ++i) {
163                 try {
164                     AdminObjectResource aor=
165                         (AdminObjectResource) resources[2][i];
166                     _runtime.deleteAdminObject(aor.getJndiName());
167                 } catch (ConnectorRuntimeException cre) {
168                     errrorOccured= true;
169                 }
170             }
171         } else if (
172             (resources[0] != null && resources[0].length != 0)
173                 || (resources[1] != null && resources[1].length != 0)
174                 || (resources[2] != null && resources[2].length != 0)) {
175             _logger.log(
176                 Level.SEVERE,
177                 "rardeployment.pools_and_resources_exist",
178                 moduleName);
179             ConnectorRuntimeException cre=
180                 new ConnectorRuntimeException("Error: Connector Connection Pools/resources exist.");
181             _logger.log(Level.SEVERE, "", cre);
182             throw cre;
183         }
184
185         if (!stopAndRemoveActiveResourceAdapter(moduleName)) {
186             ConnectorRuntimeException cre=
187                 new ConnectorRuntimeException("Failed to remove Active Resource Adapter");
188             _logger.log(
189                 Level.SEVERE,
190                 "rardeployment.ra_removal_registry_failure",
191                 moduleName);
192             _logger.log(Level.SEVERE, "", cre);
193             throw cre;
194         }
195
196         //Embedded RARs are handled by the application classloader
197
if (!(ResourcesUtil.getInstance().belongToEmbeddedRar(moduleName))) {
198             ConnectorClassLoader.getInstance().removeResourceAdapter(moduleName);
199         }
200
201         
202         if (errrorOccured == true) {
203             ConnectorRuntimeException cre=
204                 new ConnectorRuntimeException("Failed to remove all connector resources/pools");
205             _logger.log(
206                 Level.SEVERE,
207                 "rardeployment.ra_resource_removal",
208                 moduleName);
209             _logger.log(Level.SEVERE, "", cre);
210             throw cre;
211         }
212     }
213
214     /**
215      * Creates Active resource Adapter which abstracts the rar module. During
216      * the creation of ActiveResourceAdapter, default pools and resources also
217      * are created.
218      *
219      * @param connectorDescriptor
220      * object which abstracts the connector deployment descriptor
221      * i.e rar.xml and sun-ra.xml.
222      * @param moduleName
223      * Name of the module
224      * @param moduleDir
225      * Directory where rar module is exploded.
226      * @param writeSunDescriptor
227      * If true write the sun-ra.xml props to domain.xml and if false
228      * it doesnot write to domain.xml
229      * @throws ConnectorRuntimeException
230      * if creation fails.
231      */

232
233     public synchronized void createActiveResourceAdapter(
234         ConnectorDescriptor connectorDescriptor,
235         String JavaDoc moduleName,
236         String JavaDoc moduleDir,
237         boolean writeSunDescriptor)
238         throws ConnectorRuntimeException {
239         _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA "
240                         + moduleName + " at " + moduleDir );
241
242         ActiveResourceAdapter activeResourceAdapter=
243             _registry.getActiveResourceAdapter(moduleName);
244         if (activeResourceAdapter != null) {
245             _logger.log(
246                 Level.FINE,
247                 "rardeployment.resourceadapter.already.started",
248                 moduleName);
249             return;
250         }
251
252         ClassLoader JavaDoc loader= null;
253         try {
254             loader= connectorDescriptor.getClassLoader();
255         } catch (Exception JavaDoc ex) {
256             _logger.log(
257                 Level.FINE,
258                 "No classloader available with connector descriptor");
259             loader= null;
260         }
261         ModuleDescriptor moduleDescriptor= null;
262         Application application = null;
263         _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA "
264                         + moduleName + " at " + moduleDir + " loader :: " + loader);
265         if (loader == null) {
266             if (environment == SERVER) {
267                 ConnectorClassLoader.getInstance().addResourceAdapter(moduleName, moduleDir);
268                 loader = ConnectorClassLoader.getInstance();
269                 if (loader == null) {
270                     ConnectorRuntimeException cre=
271                         new ConnectorRuntimeException("Failed to obtain the class loader");
272                     _logger.log(
273                         Level.SEVERE,
274                         "rardeployment.failed_toget_classloader");
275                     _logger.log(Level.SEVERE, "", cre);
276                     throw cre;
277                 }
278             }
279         } else {
280             connectorDescriptor.setClassLoader(null);
281             moduleDescriptor= connectorDescriptor.getModuleDescriptor();
282             application = connectorDescriptor.getApplication();
283             connectorDescriptor.setModuleDescriptor(null);
284             connectorDescriptor.setApplication(null);
285         }
286         try {
287             activeResourceAdapter=
288                 ActiveRAFactory.createActiveResourceAdapter(
289                     connectorDescriptor,
290                     moduleName,
291                     loader,
292                     writeSunDescriptor);
293             _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA " +
294                             moduleName + " at " + moduleDir +
295                             " ADDING to registry " + activeResourceAdapter);
296             _registry.addActiveResourceAdapter(
297                 moduleName,
298                 activeResourceAdapter);
299             _logger.fine("ResourceAdapterAdminServiceImpl:: createActiveRA " +
300                             moduleName + " at " + moduleDir
301                             + " env =server ? " + (environment==SERVER));
302             
303             if (environment == SERVER) {
304                 activeResourceAdapter.setup();
305                 String JavaDoc descriptorJNDIName = ConnectorAdminServiceUtils.
306                             getReservePrefixedJNDINameForDescriptor(moduleName);
307                 _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA "
308                                 + moduleName + " at " + moduleDir
309                                 + " publishing descriptor " + descriptorJNDIName);
310                 //Update RAConfig in Connector Descriptor and bind in JNDI
311
//so that ACC clients could use RAConfig
312
updateRAConfigInDescriptor(connectorDescriptor, moduleName);
313                 Switch.getSwitch().getNamingManager().publishObject(
314                     descriptorJNDIName, connectorDescriptor, true);
315                 String JavaDoc securityWarningMessage=
316                     _runtime.getSecurityPermissionSpec(moduleName);
317                 // To i18N.
318
if (securityWarningMessage != null) {
319                     _logger.log(Level.WARNING, securityWarningMessage);
320                 }
321             }
322
323         } catch (NullPointerException JavaDoc npEx) {
324             ConnectorRuntimeException cre=
325                 new ConnectorRuntimeException("Error in creating active RAR");
326             cre.initCause(npEx);
327             _logger.log(
328                 Level.SEVERE,
329                 "rardeployment.nullPointerException",
330                 moduleName);
331             _logger.log(Level.SEVERE, "", cre);
332             throw cre;
333         } catch (NamingException ne) {
334             ConnectorRuntimeException cre=
335                 new ConnectorRuntimeException("Error in creating active RAR");
336             cre.initCause(ne);
337             _logger.log(Level.SEVERE, "rardeployment.jndi_publish_failure");
338             _logger.log(Level.SEVERE, "", cre);
339             throw cre;
340         } finally {
341             if (moduleDescriptor != null) {
342                 connectorDescriptor.setModuleDescriptor(moduleDescriptor);
343                 connectorDescriptor.setApplication(application);
344                 connectorDescriptor.setClassLoader(loader);
345             }
346         }
347     }
348
349     /*
350      * Updates the connector descriptor of the connector module, with the
351      * contents of a resource adapter config if specified.
352      *
353      * This modified ConnectorDescriptor is then bound to JNDI so that ACC
354      * clients while configuring a non-system RAR could get the correct merged
355      * configuration. Any updates to resource-adapter config while an ACC client
356      * is in use is not transmitted to the client dynamically. All such changes
357      * would be visible on ACC client restart.
358      */

359     private void updateRAConfigInDescriptor(ConnectorDescriptor connectorDescriptor,
360                     String JavaDoc moduleName) {
361
362         ResourceAdapterConfig raConfig =
363             ConnectorRegistry.getInstance().getResourceAdapterConfig(moduleName);
364
365         ElementProperty[] raConfigProps = null;
366         if(raConfig != null) {
367             raConfigProps = raConfig.getElementProperty();
368         }
369
370         _logger.fine("current RAConfig In Descriptor " + connectorDescriptor.getConfigProperties());
371
372         if(raConfigProps != null) {
373             Set JavaDoc mergedProps = ConnectorDDTransformUtils.mergeProps(
374                     raConfigProps, connectorDescriptor.getConfigProperties());
375             Set JavaDoc actualProps = connectorDescriptor.getConfigProperties();
376             actualProps.clear();
377             actualProps.addAll(mergedProps);
378             _logger.fine("updated RAConfig In Descriptor " + connectorDescriptor.getConfigProperties());
379         }
380
381     }
382
383
384     /**
385      * Creates Active resource Adapter which abstracts the rar module. During
386      * the creation of ActiveResourceAdapter, default pools and resources also
387      * are created.
388      *
389      * @param moduleDir
390      * Directory where rar module is exploded.
391      * @param moduleName
392      * Name of the module
393      * @param writeSunDescriptor
394      * If true write the sun-ra.xml props to domain.xml and if false
395      * it doesnot write to domain.xml
396      * @throws ConnectorRuntimeException
397      * if creation fails.
398      */

399
400     public synchronized void createActiveResourceAdapter(
401         String JavaDoc moduleDir,
402         String JavaDoc moduleName,
403         boolean writeSunDescriptor)
404         throws ConnectorRuntimeException {
405
406         ActiveResourceAdapter activeResourceAdapter=
407             _registry.getActiveResourceAdapter(moduleName);
408         if (activeResourceAdapter != null) {
409             _logger.log(
410                 Level.FINE,
411                 "rardeployment.resourceadapter.already.started",
412                 moduleName);
413             return;
414         }
415
416         if (ResourcesUtil.getInstance().belongToSystemRar(moduleName)) {
417             moduleDir = Switch.getSwitch().getResourceInstaller().
418                         getSystemModuleLocation(moduleName);
419         }
420
421         ConnectorDescriptor connectorDescriptor= null;
422         connectorDescriptor=
423             ConnectorDDTransformUtils.getConnectorDescriptor(moduleDir);
424         if (connectorDescriptor == null) {
425             ConnectorRuntimeException cre=
426                 new ConnectorRuntimeException("Failed to obtain the connectorDescriptor");
427             _logger.log(
428                 Level.SEVERE,
429                 "rardeployment.connector_descriptor_notfound",
430                 moduleName);
431             _logger.log(Level.SEVERE, "", cre);
432             throw cre;
433         }
434         createActiveResourceAdapter(
435             connectorDescriptor,
436             moduleName,
437             moduleDir,
438             writeSunDescriptor);
439     }
440
441     /**
442      * The ActiveResourceAdapter object which abstract the rar module is
443      * recreated in the connector container/registry. All the pools and
444      * resources are killed. But the infrastructure to create the pools and and
445      * resources is untouched. Only the actual pool is killed.
446      *
447      * @param moduleName
448      * rar module Name.
449      * @throws ConnectorRuntimeException
450      * if recreation fails.
451      */

452
453     public void reCreateActiveResourceAdapter(String JavaDoc moduleName)
454         throws ConnectorRuntimeException {
455         String JavaDoc moduleDir= null;
456         if (isRarDeployed(moduleName)) {
457             _runtime.killAllPools(moduleName);
458             stopAndRemoveActiveResourceAdapter(moduleName);
459             moduleDir= ResourcesUtil.getInstance().getLocation(moduleName);
460             createActiveResourceAdapter(moduleDir, moduleName, false);
461         } else {
462             moduleDir= ResourcesUtil.getInstance().getLocation(moduleName);
463             if (moduleDir != null) {
464                 createActiveResourceAdapter(moduleDir, moduleName, false);
465             }
466         }
467     }
468
469     /**
470      * Stops the resourceAdapter and removes it from connector container/
471      * registry.
472      *
473      * @param moduleName
474      * Rarmodule name.
475      * @return true it is successful stop and removal of ActiveResourceAdapter
476      * false it stop and removal fails.
477      */

478
479     public boolean stopAndRemoveActiveResourceAdapter(String JavaDoc moduleName) {
480
481         ActiveResourceAdapter acr= null;
482         if (moduleName != null) {
483             acr= _registry.getActiveResourceAdapter(moduleName);
484         }
485         if (acr != null) {
486             acr.destroy();
487             boolean ret= _registry.removeActiveResourceAdapter(moduleName);
488             return ret;
489         }
490         return false;
491     }
492
493     public void addResourceAdapterConfig(
494         String JavaDoc rarName,
495         ResourceAdapterConfig raConfig)
496         throws ConnectorRuntimeException {
497         if (rarName != null && raConfig != null) {
498             _registry.addResourceAdapterConfig(rarName, raConfig);
499             reCreateActiveResourceAdapter(rarName);
500         }
501     }
502
503     /**
504      * Delete the resource adapter configuration to the connector registry
505      *
506      * @param rarName
507      * rarmodule
508      */

509
510     public void deleteResourceAdapterConfig(String JavaDoc rarName) {
511         if (rarName != null) {
512             _registry.removeResourceAdapterConfig(rarName);
513         }
514     }
515
516     public static boolean isJmsRa() {
517         //return System.getProperty("jms.ra").equals("true");
518
return true;
519     }
520
521     public JmsRaMapping getJmsRaMapping() {
522         return ramap;
523     }
524
525     /**
526      * Checks if the rar module is already reployed.
527      *
528      * @param moduleName
529      * Rarmodule name
530      * @return true if it is already deployed. false if it is not deployed.
531      */

532
533     public boolean isRarDeployed(String JavaDoc moduleName) {
534
535         ActiveResourceAdapter activeResourceAdapter=
536             _registry.getActiveResourceAdapter(moduleName);
537         if (activeResourceAdapter != null) {
538             return true;
539         } else {
540             return false;
541         }
542     }
543     
544     /**
545      * Calls the stop method for all J2EE Connector 1.5 spec compliant RARs
546      */

547     public void stopAllActiveResourceAdapters() {
548         try {
549             resource_adapter_shutdown_timeout =
550                 ResourcesUtil.getInstance().getShutdownTimeout();
551         } catch (ConnectorRuntimeException e) {
552             _logger.log(Level.WARNING, "error_reading_connectorservice_elt", e);
553             //Going ahead with the default timeout value
554
resource_adapter_shutdown_timeout
555             = ConnectorConstants.DEFAULT_RESOURCE_ADAPTER_SHUTDOWN_TIMEOUT;
556         }
557         ActiveResourceAdapter[] resourceAdapters =
558             ConnectorRegistry.getInstance().getAllActiveResourceAdapters();
559
560         //find all Connector 1.5 Spec Compliant resource adapters
561
ArrayList JavaDoc resourceAdaptersToStop = new ArrayList JavaDoc();
562         for (int i = 0; i < resourceAdapters.length; i++) {
563             if (resourceAdapters[i] instanceof ActiveInboundResourceAdapter){
564                 _logger.log(Level.FINE, "Connector 1.5 spec compliant RA",
565                         resourceAdapters[i].getModuleName());
566                 raShutdownStatusTable.put(
567                       resourceAdapters[i].getModuleName(), new Boolean JavaDoc(false));
568                 resourceAdaptersToStop.add(resourceAdapters[i]);
569             } else {
570                 _logger.log(Level.FINE, "Connector 1.0 spec compliant RA",
571                         resourceAdapters[i].getModuleName());
572             }
573         }
574         ActiveResourceAdapter[] raToStop = (ActiveResourceAdapter[])
575             resourceAdaptersToStop.toArray(new ActiveResourceAdapter[]{});
576         sendStopToAllResourceAdapters(raToStop);
577     }
578
579     
580     
581     /**
582      * Calls the stop method for all J2EE Connector 1.5 spec compliant RARs
583      * @param resourceAdapters
584      */

585     private void sendStopToAllResourceAdapters(ActiveResourceAdapter[]
586                                                        resourceAdaptersToStop) {
587         //Only J2EE Connector 1.5 compliant RAs needs to be stopped
588
int numberOfResourceAdaptersToStop = 0;
589
590         numberOfResourceAdaptersToStop = resourceAdaptersToStop.length;
591        
592         Thread JavaDoc[] raShutDownThreads = new Thread JavaDoc[numberOfResourceAdaptersToStop];
593         Thread JavaDoc[] joinerThreads = new Thread JavaDoc[numberOfResourceAdaptersToStop];
594
595         //Start ResourceAdapter shutdownthreads and then
596
//Start Threads to join the resource adapter shutdownThreads
597
for (int i = 0; i < numberOfResourceAdaptersToStop; i++) {
598             
599             _logger.log(Level.FINE, "Starting RA shutdown thread for "
600                     + ( (ActiveInboundResourceAdapter)resourceAdaptersToStop[i] )
601                             .getModuleName() );
602             Thread JavaDoc rast = new RAShutdownThread(
603                   (ActiveInboundResourceAdapter)resourceAdaptersToStop[i]);
604             raShutDownThreads[i] = rast;
605             rast.start();
606             
607             _logger.log(Level.FINE, "Starting Thread to join time-out " +
608                     "shutdown of " +
609                     ( ( ActiveInboundResourceAdapter )resourceAdaptersToStop[i]).getModuleName() );
610             Thread JavaDoc joiner = new JoinerThread(raShutDownThreads[i]);
611             joinerThreads[i] = joiner;
612             joiner.start();
613         }
614         
615         //Join all the Joiner threads
616
for (int i = 0; i < joinerThreads.length; i++) {
617             try {
618                 _logger.log(Level.FINE, "Joining joiner thread of "
619                        + ((ActiveResourceAdapter)resourceAdaptersToStop[i])
620                                 .getModuleName() );
621                 joinerThreads[i].join();
622             } catch (InterruptedException JavaDoc e) {
623                 e.printStackTrace();
624             }
625         }
626         
627         _logger.log(Level.FINE, "stop() Complete for all " +
628                 "active 1.5 compliant RARs");
629
630         //Log the status of the stop() call
631
if (resourceAdaptersToStop.length != 0) {
632             _logger.log(Level.FINE, "resource_adapter_stop_status");
633         }
634         
635         for (Iterator JavaDoc iter = raShutdownStatusTable.keySet().iterator();
636                                             iter.hasNext();) {
637             String JavaDoc raName = (String JavaDoc) iter.next();
638             if(((Boolean JavaDoc)raShutdownStatusTable.get(raName)).booleanValue()) {
639                 _logger.log(Level.INFO, "ra.stop-successful", raName);
640             } else {
641                 _logger.log(Level.WARNING, "ra.stop-unsuccessful", raName);
642             }
643         }
644     }
645
646     private class JoinerThread extends Thread JavaDoc {
647         private Thread JavaDoc threadToJoin;
648         
649         public JoinerThread(Thread JavaDoc threadToJoin) {
650             this.threadToJoin = threadToJoin;
651         }
652         
653         public void run() {
654             try {
655                 this.threadToJoin.join(ResourceAdapterAdminServiceImpl.this.
656                         resource_adapter_shutdown_timeout * 1000);
657             } catch (InterruptedException JavaDoc e) {
658                 e.printStackTrace();
659             }
660         }
661     }
662
663     private class RAShutdownThread extends Thread JavaDoc {
664         private ActiveInboundResourceAdapter ra;
665
666         public RAShutdownThread(ActiveInboundResourceAdapter ratoBeShutDown){
667             super();
668             this.ra = ratoBeShutDown;
669             //This thread is a daemon thread
670
this.setDaemon(true);
671         }
672
673         public void run() {
674             _logger.log(Level.FINE, "Calling" + ra.getModuleName()
675                     + " shutdown ");
676             this.ra.destroy();
677             ResourceAdapterAdminServiceImpl.this.raShutdownStatusTable.put(
678                     ra.getModuleName(), new Boolean JavaDoc(true));
679         }
680     }
681
682 }
683
Popular Tags