Class ManagedLedgerFactoryImpl
java.lang.Object
org.apache.bookkeeper.mledger.impl.ManagedLedgerFactoryImpl
- All Implemented Interfaces:
ManagedLedgerFactory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFactory to create Bookkeeper-client for a given ensemblePlacementPolicy. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConcurrentHashMap<String,CompletableFuture<ManagedLedgerImpl>> protected final ManagedLedgerFactoryMBeanImplprotected final ConcurrentHashMap<String,org.apache.bookkeeper.mledger.impl.ManagedLedgerFactoryImpl.PendingInitializeManagedLedger> protected final org.apache.bookkeeper.common.util.OrderedScheduler -
Constructor Summary
ConstructorsConstructorDescriptionManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, BookKeeper bookKeeper) ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, BookKeeper bookKeeper, ManagedLedgerFactoryConfig config) ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, org.apache.bookkeeper.conf.ClientConfiguration bkClientConfiguration) ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, org.apache.bookkeeper.conf.ClientConfiguration bkClientConfiguration, ManagedLedgerFactoryConfig config) ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, ManagedLedgerFactoryImpl.BookkeeperFactoryForCustomEnsemblePlacementPolicy bookKeeperGroupFactory, ManagedLedgerFactoryConfig config) ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, ManagedLedgerFactoryImpl.BookkeeperFactoryForCustomEnsemblePlacementPolicy bookKeeperGroupFactory, ManagedLedgerFactoryConfig config, org.apache.bookkeeper.stats.StatsLogger statsLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidasyncDelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture, AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Delete a managed ledger.voidasyncDelete(String name, AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Delete a managed ledger.asyncExists(String ledgerName) Check managed ledger has been initialized before.voidasyncGetManagedLedgerInfo(String name, AsyncCallbacks.ManagedLedgerInfoCallback callback, Object ctx) Asynchronously get the current metadata info for a managed ledger.voidasyncOpen(String name, AsyncCallbacks.OpenLedgerCallback callback, Object ctx) Asynchronous open method.voidasyncOpen(String name, ManagedLedgerConfig config, AsyncCallbacks.OpenLedgerCallback callback, Supplier<CompletableFuture<Boolean>> mlOwnershipChecker, Object ctx) Asynchronous open method.voidasyncOpenReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config, AsyncCallbacks.OpenReadOnlyCursorCallback callback, Object ctx) Open aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.voidasyncOpenReadOnlyManagedLedger(String managedLedgerName, AsyncCallbacks.OpenReadOnlyManagedLedgerCallback callback, ManagedLedgerConfig config, Object ctx) Asynchronous open a Read-only managedLedger.voidDelete a managed ledger.voiddelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture) Delete a managed ledger.longgetManagedLedgerInfo(String name) Get the current metadata info for a managed ledger.Helper for getting stats.Open a managed ledger.open(String name, ManagedLedgerConfig config) Open a managed ledger.openReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config) Open aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.voidshutdown()Releases all the resources maintained by the ManagedLedgerFactory.This method tries it's best to releases all the resources maintained by the ManagedLedgerFactory.voidupdateCacheEvictionTimeThreshold(long cacheEvictionTimeThresholdNanos) update cache evictionTimeThreshold.
-
Field Details
-
scheduledExecutor
protected final org.apache.bookkeeper.common.util.OrderedScheduler scheduledExecutor -
mbean
-
ledgers
-
pendingInitializeLedgers
protected final ConcurrentHashMap<String,org.apache.bookkeeper.mledger.impl.ManagedLedgerFactoryImpl.PendingInitializeManagedLedger> pendingInitializeLedgers
-
-
Constructor Details
-
ManagedLedgerFactoryImpl
public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, org.apache.bookkeeper.conf.ClientConfiguration bkClientConfiguration) throws Exception - Throws:
Exception
-
ManagedLedgerFactoryImpl
public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, org.apache.bookkeeper.conf.ClientConfiguration bkClientConfiguration, ManagedLedgerFactoryConfig config) throws Exception - Throws:
Exception
-
ManagedLedgerFactoryImpl
public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, BookKeeper bookKeeper) throws Exception - Throws:
Exception
-
ManagedLedgerFactoryImpl
public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, BookKeeper bookKeeper, ManagedLedgerFactoryConfig config) throws Exception - Throws:
Exception
-
ManagedLedgerFactoryImpl
public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, ManagedLedgerFactoryImpl.BookkeeperFactoryForCustomEnsemblePlacementPolicy bookKeeperGroupFactory, ManagedLedgerFactoryConfig config) throws Exception - Throws:
Exception
-
ManagedLedgerFactoryImpl
public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, ManagedLedgerFactoryImpl.BookkeeperFactoryForCustomEnsemblePlacementPolicy bookKeeperGroupFactory, ManagedLedgerFactoryConfig config, org.apache.bookkeeper.stats.StatsLogger statsLogger) throws Exception - Throws:
Exception
-
-
Method Details
-
getManagedLedgers
Helper for getting stats.- Returns:
-
open
Description copied from interface:ManagedLedgerFactoryOpen a managed ledger. If the managed ledger does not exist, a new one will be automatically created. Uses the default configuration parameters.- Specified by:
openin interfaceManagedLedgerFactory- Parameters:
name- the unique name that identifies the managed ledger- Returns:
- the managed ledger
- Throws:
ManagedLedgerExceptionInterruptedException
-
open
public ManagedLedger open(String name, ManagedLedgerConfig config) throws InterruptedException, ManagedLedgerException Description copied from interface:ManagedLedgerFactoryOpen a managed ledger. If the managed ledger does not exist, a new one will be automatically created.- Specified by:
openin interfaceManagedLedgerFactory- Parameters:
name- the unique name that identifies the managed ledgerconfig- managed ledger configuration- Returns:
- the managed ledger
- Throws:
ManagedLedgerExceptionInterruptedException
-
asyncOpen
Description copied from interface:ManagedLedgerFactoryAsynchronous open method.- Specified by:
asyncOpenin interfaceManagedLedgerFactory- Parameters:
name- the unique name that identifies the managed ledgercallback- callback objectctx- opaque context- See Also:
-
asyncOpen
public void asyncOpen(String name, ManagedLedgerConfig config, AsyncCallbacks.OpenLedgerCallback callback, Supplier<CompletableFuture<Boolean>> mlOwnershipChecker, Object ctx) Description copied from interface:ManagedLedgerFactoryAsynchronous open method.- Specified by:
asyncOpenin interfaceManagedLedgerFactory- Parameters:
name- the unique name that identifies the managed ledgerconfig- managed ledger configurationcallback- callback objectmlOwnershipChecker- checks ml-ownership in case updating ml-metadata fails due to ownership conflictctx- opaque context- See Also:
-
asyncOpenReadOnlyManagedLedger
public void asyncOpenReadOnlyManagedLedger(String managedLedgerName, AsyncCallbacks.OpenReadOnlyManagedLedgerCallback callback, ManagedLedgerConfig config, Object ctx) Description copied from interface:ManagedLedgerFactoryAsynchronous open a Read-only managedLedger.- Specified by:
asyncOpenReadOnlyManagedLedgerin interfaceManagedLedgerFactory- Parameters:
managedLedgerName- the unique name that identifies the managed ledgerconfig- the managed ledger configuration.ctx- opaque context
-
openReadOnlyCursor
public ReadOnlyCursor openReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config) throws InterruptedException, ManagedLedgerException Description copied from interface:ManagedLedgerFactoryOpen aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.- Specified by:
openReadOnlyCursorin interfaceManagedLedgerFactorystartPosition- set the cursor on that particular position. If setting to `PositionImpl.earliest` it will be positioned on the first available entry.- Returns:
- Throws:
InterruptedExceptionManagedLedgerException
-
asyncOpenReadOnlyCursor
public void asyncOpenReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config, AsyncCallbacks.OpenReadOnlyCursorCallback callback, Object ctx) Description copied from interface:ManagedLedgerFactoryOpen aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.- Specified by:
asyncOpenReadOnlyCursorin interfaceManagedLedgerFactorystartPosition- set the cursor on that particular position. If setting to `PositionImpl.earliest` it will be positioned on the first available entry.
-
shutdownAsync
Description copied from interface:ManagedLedgerFactoryThis method tries it's best to releases all the resources maintained by the ManagedLedgerFactory. It will take longer time to shutdown than shutdown();- Specified by:
shutdownAsyncin interfaceManagedLedgerFactory- Throws:
ManagedLedgerException- See Also:
-
shutdown
Description copied from interface:ManagedLedgerFactoryReleases all the resources maintained by the ManagedLedgerFactory.- Specified by:
shutdownin interfaceManagedLedgerFactory- Throws:
ManagedLedgerExceptionInterruptedException
-
asyncExists
Description copied from interface:ManagedLedgerFactoryCheck managed ledger has been initialized before.- Specified by:
asyncExistsin interfaceManagedLedgerFactory- Parameters:
ledgerName-String- Returns:
- a future represents the result of the operation.
an instance of
Booleanis returned if the operation succeeds.
-
getManagedLedgerInfo
public ManagedLedgerInfo getManagedLedgerInfo(String name) throws InterruptedException, ManagedLedgerException Description copied from interface:ManagedLedgerFactoryGet the current metadata info for a managed ledger.- Specified by:
getManagedLedgerInfoin interfaceManagedLedgerFactory- Parameters:
name- the unique name that identifies the managed ledger- Throws:
InterruptedExceptionManagedLedgerException
-
asyncGetManagedLedgerInfo
public void asyncGetManagedLedgerInfo(String name, AsyncCallbacks.ManagedLedgerInfoCallback callback, Object ctx) Description copied from interface:ManagedLedgerFactoryAsynchronously get the current metadata info for a managed ledger.- Specified by:
asyncGetManagedLedgerInfoin interfaceManagedLedgerFactory- Parameters:
name- the unique name that identifies the managed ledgercallback- callback objectctx- opaque context
-
delete
Description copied from interface:ManagedLedgerFactoryDelete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Specified by:
deletein interfaceManagedLedgerFactory- Throws:
InterruptedExceptionManagedLedgerException
-
delete
public void delete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture) throws InterruptedException, ManagedLedgerException Description copied from interface:ManagedLedgerFactoryDelete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Specified by:
deletein interfaceManagedLedgerFactory- Throws:
InterruptedExceptionManagedLedgerException
-
asyncDelete
Description copied from interface:ManagedLedgerFactoryDelete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Specified by:
asyncDeletein interfaceManagedLedgerFactory
-
asyncDelete
public void asyncDelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture, AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Description copied from interface:ManagedLedgerFactoryDelete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Specified by:
asyncDeletein interfaceManagedLedgerFactory
-
getManagedLedgerPropertiesAsync
- Specified by:
getManagedLedgerPropertiesAsyncin interfaceManagedLedgerFactory- Returns:
- properties of this managedLedger.
-
getMetaStore
-
getConfig
-
getEntryCacheManager
- Specified by:
getEntryCacheManagerin interfaceManagedLedgerFactory- Returns:
- return EntryCacheManager.
-
updateCacheEvictionTimeThreshold
public void updateCacheEvictionTimeThreshold(long cacheEvictionTimeThresholdNanos) Description copied from interface:ManagedLedgerFactoryupdate cache evictionTimeThreshold.- Specified by:
updateCacheEvictionTimeThresholdin interfaceManagedLedgerFactory- Parameters:
cacheEvictionTimeThresholdNanos- time threshold for eviction.
-
getCacheEvictionTimeThreshold
public long getCacheEvictionTimeThreshold()- Specified by:
getCacheEvictionTimeThresholdin interfaceManagedLedgerFactory- Returns:
- time threshold for eviction.
-
getCacheStats
-
getBookKeeper
-