本文整理了Java中com.google.inject.Singleton
类的一些代码示例,展示了Singleton
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Singleton
类的具体详情如下:
包路径:com.google.inject.Singleton
类名称:Singleton
暂无
代码示例来源:origin: apache/usergrid
/**
* Configure via explicit declaration the migration path we can follow
* @param v1
* @param v2
* @return
*/
@Singleton
@Inject
@Provides
public VersionedMigrationSet<EdgeMetadataSerialization> getVersions(final EdgeMetadataSerializationV1Impl v1, final EdgeMetadataSerializationV2Impl v2){
//migrate from v1 to v2
MigrationRelationship<EdgeMetadataSerialization> v1Tov2 = new MigrationRelationship<>( v1, v2);
//keep our curent tuple, v2, v2
MigrationRelationship<EdgeMetadataSerialization> current = new MigrationRelationship<EdgeMetadataSerialization>( v2, v2 );
//now create our set of versions
VersionedMigrationSet<EdgeMetadataSerialization> set = new VersionedMigrationSet<>( v1Tov2, current );
return set;
}
代码示例来源:origin: killbill/killbill
@Provides
@Singleton
@Named(IDBISetup.MAIN_RO_IDBI_NAMED)
protected IDBI provideRoIDBI(final IDBI idbi) {
return idbi;
}
}
代码示例来源:origin: apache/shiro
@Singleton
class FilterChainResolverProvider implements ProviderWithDependencies<FilterChainResolver> {
@Inject
Injector injector;
代码示例来源:origin: google/data-transfer-project
@Provides
@Singleton
JsonFactory getJsonFactory() {
return jsonFactory;
}
代码示例来源:origin: apache/incubator-wave
@Provides
@Singleton
@Inject
@Named("DataApiRegistry")
protected OperationServiceRegistry provideDataApiRegistry(Injector injector) {
return new DataApiOperationServiceRegistry(injector);
}
代码示例来源:origin: org.apache.stratos/gce
@Singleton
public static class CredentialTypeFromPropertyOrDefault implements Provider<CredentialType> {
@Inject(optional = true)
@Named(OAuthProperties.CREDENTIAL_TYPE)
String credentialType = CredentialType.SERVICE_ACCOUNT_CREDENTIALS.toString();
@Override
public CredentialType get() {
return CredentialType.fromValue(credentialType);
}
}
代码示例来源:origin: Netflix/zuul
/**
* Author: Susheel Aroskar
* Date: 5/16/18
*/
@Singleton
public class SamplePushMessageSenderInitializer extends PushMessageSenderInitializer {
private final PushMessageSender pushMessageSender;
@Inject
public SamplePushMessageSenderInitializer(PushConnectionRegistry pushConnectionRegistry) {
super(pushConnectionRegistry);
pushMessageSender = new SamplePushMessageSender(pushConnectionRegistry);
}
@Override
protected PushMessageSender getPushMessageSender(PushConnectionRegistry pushConnectionRegistry) {
return pushMessageSender;
}
}
代码示例来源:origin: killbill/killbill
@Provides
@Singleton
@Named(IDBISetup.MAIN_RO_IDBI_NAMED)
protected IDBI provideRoIDBIInAComplicatedWayBecauseOf627(final IDBI idbi) {
return idbi;
}
代码示例来源:origin: ninjaframework/ninja
@Singleton
public class Scheduler {
private static final Logger log = LoggerFactory.getLogger(Scheduler.class);
@Inject
private Injector injector;
private volatile ScheduledExecutorService executor;
代码示例来源:origin: google/data-transfer-project
@Provides
@Singleton
ExtensionContext getContext() {
return context;
}
}
代码示例来源:origin: apache/incubator-wave
@Provides
@Singleton
@Inject
@Named("ActiveApiRegistry")
protected OperationServiceRegistry provideActiveApiRegistry(Injector injector) {
return new ActiveApiOperationServiceRegistry(injector);
}
代码示例来源:origin: Netflix/zuul
/**
* Author: Susheel Aroskar
* Date: 5/16/18
*/
@Singleton
public class SamplePushMessageSenderInitializer extends PushMessageSenderInitializer {
private final PushMessageSender pushMessageSender;
@Inject
public SamplePushMessageSenderInitializer(PushConnectionRegistry pushConnectionRegistry) {
super(pushConnectionRegistry);
pushMessageSender = new SamplePushMessageSender(pushConnectionRegistry);
}
@Override
protected PushMessageSender getPushMessageSender(PushConnectionRegistry pushConnectionRegistry) {
return pushMessageSender;
}
}
代码示例来源:origin: apache/usergrid
/**
* Configure via explicit declaration the migration path we can follow
*/
@Singleton
@Inject
@Provides
public VersionedMigrationSet<MvccLogEntrySerializationStrategy> getVersions(
final MvccLogEntrySerializationStrategyV1Impl v1, final MvccLogEntrySerializationStrategyV2Impl v2) {
//we must perform a migration from v1 to v3 in order to maintain consistency
MigrationRelationship<MvccLogEntrySerializationStrategy> v1Tov2 = new MigrationRelationship<>( v1, v2 );
//note that we MUST migrate to v3 before our next migration, if v4 and v5 is implemented we will need a
// v3->v5 and a v4->v5 set
MigrationRelationship<MvccLogEntrySerializationStrategy> current =
new MigrationRelationship<>( v2, v2 );
//now create our set of versions
VersionedMigrationSet<MvccLogEntrySerializationStrategy> set =
new VersionedMigrationSet<>( v1Tov2, current );
return set;
}
代码示例来源:origin: jmxtrans/jmxtrans
@Provides
@Singleton
@Named("resultExecutorRepository")
ExecutorRepository resultExecutorRepository() throws MalformedObjectNameException {
int poolSize = configuration.getResultProcessorExecutorPoolSize();
int workQueueCapacity = configuration.getResultProcessorExecutorWorkQueueCapacity();
String executorAlias = "result";
return createExecutorRepository(poolSize, workQueueCapacity, executorAlias);
}
代码示例来源:origin: apache/usergrid
@Singleton
public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, CollectionIoEvent<MvccEntity>> {
UniqueValuesService akkaUvService;
@Inject
private UniqueValueSerializationStrategy uniqueValueStrat;
代码示例来源:origin: google/data-transfer-project
@Provides
@Singleton
ObjectMapper getObjectMapper() {
return objectMapper;
}
代码示例来源:origin: apache/usergrid
/**
* Configure via explicit declaration the migration path we can follow
*/
@Singleton
@Inject
@Provides
public VersionedMigrationSet<UniqueValueSerializationStrategy> getVersions(
final UniqueValueSerializationStrategyV1Impl v1, final UniqueValueSerializationStrategyV2Impl v2) {
//we must perform a migration from v1 to v3 in order to maintain consistency
MigrationRelationship<UniqueValueSerializationStrategy> v1Tov2 = new MigrationRelationship<>( v1, v2 );
//note that we MUST migrate to v3 before our next migration, if v4 and v5 is implemented we will need a
// v3->v5 and a v4->v5 set
MigrationRelationship<UniqueValueSerializationStrategy> current =
new MigrationRelationship<>( v2, v2 );
//now create our set of versions
VersionedMigrationSet<UniqueValueSerializationStrategy> set =
new VersionedMigrationSet<>( v1Tov2, current );
return set;
}
}
代码示例来源:origin: jmxtrans/jmxtrans
@Provides
@Singleton
@Named("queryExecutorRepository")
ExecutorRepository queryExecutorRepository() throws MalformedObjectNameException {
int poolSize = configuration.getQueryProcessorExecutorPoolSize();
int workQueueCapacity = configuration.getQueryProcessorExecutorWorkQueueCapacity();
String executorAlias = "query";
return createExecutorRepository(poolSize, workQueueCapacity, executorAlias);
}
代码示例来源:origin: glyptodon/guacamole-client
@Singleton
public class CodeUsageTrackingService {
@Inject
private ConfigurationService confService;
代码示例来源:origin: google/data-transfer-project
@Provides
@Singleton
Monitor getMonitor() {
return monitor;
}
内容来源于网络,如有侵权,请联系作者删除!