Package: AsyncShutdownDecorator$1

AsyncShutdownDecorator$1

nameinstructionbranchcomplexitylinemethod
run()
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
{...}
M: 21 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2008, 2010 VMware Inc.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * VMware Inc. - initial contribution
10: *******************************************************************************/
11:
12: package org.eclipse.virgo.nano.core.internal;
13:
14: import org.eclipse.virgo.nano.core.Shutdown;
15:
16: /**
17: * Decorator for a {@link Shutdown} implementation that performs all operations asynchronously.
18: * <p />
19: *
20: * <strong>Concurrent Semantics</strong><br />
21: *
22: * Threadsafe.
23: *
24: */
25: final class AsyncShutdownDecorator implements Shutdown {
26:
27: private static final String THREAD_NAME = "kernel-shutdown";
28: private final Shutdown delegate;
29:
30: public AsyncShutdownDecorator(Shutdown delegate) {
31: this.delegate = delegate;
32: }
33:
34: /**
35: * {@inheritDoc}
36: */
37: public void immediateShutdown() {
38: new Thread(new Runnable() {
39:
40: public void run() {
41: AsyncShutdownDecorator.this.delegate.immediateShutdown();
42: }
43:
44: }, THREAD_NAME).start();
45: }
46:
47: /**
48: * {@inheritDoc}
49: */
50: public void shutdown() {
51: new Thread(new Runnable() {
52:
53: public void run() {
54: AsyncShutdownDecorator.this.delegate.shutdown();
55: }
56:
57: }, THREAD_NAME).start();
58:
59: }
60:
61: }