1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.named.providers;
20
21 import javax.inject.Named;
22 import javax.inject.Singleton;
23
24 import java.util.concurrent.TimeUnit;
25
26 import org.eclipse.aether.named.NamedLockKey;
27 import org.eclipse.aether.named.support.NamedLockFactorySupport;
28 import org.eclipse.aether.named.support.NamedLockSupport;
29
30
31
32
33 @Singleton
34 @Named(NoopNamedLockFactory.NAME)
35 public class NoopNamedLockFactory extends NamedLockFactorySupport {
36 public static final String NAME = "noop";
37
38 @Override
39 protected NoopNamedLock createLock(final NamedLockKey key) {
40 return new NoopNamedLock(key, this);
41 }
42
43 private static final class NoopNamedLock extends NamedLockSupport {
44 private NoopNamedLock(final NamedLockKey key, final NamedLockFactorySupport factory) {
45 super(key, factory);
46 }
47
48 @Override
49 protected boolean doLockShared(final long time, final TimeUnit unit) {
50 return true;
51 }
52
53 @Override
54 protected boolean doLockExclusively(final long time, final TimeUnit unit) {
55 return true;
56 }
57
58 @Override
59 protected void doUnlock() {
60
61 }
62 }
63 }