use of org.apache.geode.admin.AdminException in project geode by apache.
the class ConnectionNotificationFilterImpl method initializeHelperMbean.
private void initializeHelperMbean() {
try {
memberInfoWithStatsMBean = new MemberInfoWithStatsMBean(this);
MBeanServer mbs = getMBeanServer();
mbs.registerMBean(memberInfoWithStatsMBean, memberInfoWithStatsMBean.getObjectName());
/*
* We are not re-throwing these exceptions as failure create/register the GemFireTypesWrapper
* will not stop the Agent from working. But we are logging it as it could be an indication of
* some problem. Also not creating Localized String for the exception.
*/
} catch (OperationsException e) {
logger.info(LocalizedMessage.create(LocalizedStrings.AgentImpl_FAILED_TO_INITIALIZE_MEMBERINFOWITHSTATSMBEAN), e);
} catch (MBeanRegistrationException e) {
logger.info(LocalizedMessage.create(LocalizedStrings.AgentImpl_FAILED_TO_INITIALIZE_MEMBERINFOWITHSTATSMBEAN), e);
} catch (AdminException e) {
logger.info(LocalizedMessage.create(LocalizedStrings.AgentImpl_FAILED_TO_INITIALIZE_MEMBERINFOWITHSTATSMBEAN), e);
}
}
use of org.apache.geode.admin.AdminException in project geode by apache.
the class RemoteGemFireVM method getBridgeInfo.
public AdminBridgeServer getBridgeInfo(CacheInfo cache, int bridgeRef) throws AdminException {
BridgeServerRequest request = BridgeServerRequest.createForInfo(cache, bridgeRef);
BridgeServerResponse response = (BridgeServerResponse) sendAndWait(request);
if (response.getException() != null) {
Exception ex = response.getException();
throw new AdminException(ex.getMessage(), ex);
} else {
return response.getBridgeInfo();
}
}
use of org.apache.geode.admin.AdminException in project geode by apache.
the class RemoteGemFireVM method createSubregion.
public Region createSubregion(CacheInfo c, String parentPath, String regionPath, RegionAttributes attrs) throws AdminException {
RegionResponse resp = (RegionResponse) sendAndWait(RegionRequest.createForCreateSubregion(c, parentPath, regionPath, attrs));
Exception ex = resp.getException();
if (ex != null) {
throw new AdminException(LocalizedStrings.RemoteGemFireVM_WHILE_CREATING_SUBREGION_0_OF_1.toLocalizedString(new Object[] { regionPath, parentPath }), ex);
} else {
return resp.getRegion(this);
}
}
use of org.apache.geode.admin.AdminException in project geode by apache.
the class IncrementalBackupDUnitTest method testMissingBaseline.
/**
* Successful if all members perform a full backup when they share the baseline directory and it
* is missing.
*/
@Test
public void testMissingBaseline() throws Exception {
/*
* Get the member ID for VM 1 and perform a baseline.
*/
String memberId = getMemberId(Host.getHost(0).getVM(1));
assertBackupStatus(performBaseline());
/*
* Find all of the member's oplogs in the baseline (*.crf,*.krf,*.drf)
*/
Collection<File> memberBaselineOplogs = FileUtils.listFiles(getBackupDirForMember(getBaselineDir(), memberId), new RegexFileFilter(OPLOG_REGEX), DirectoryFileFilter.DIRECTORY);
assertFalse(memberBaselineOplogs.isEmpty());
List<String> memberBaselineOplogNames = new LinkedList<>();
TransformUtils.transform(memberBaselineOplogs, memberBaselineOplogNames, TransformUtils.fileNameTransformer);
/*
* Custom incremental backup callable that retrieves the current baseline before deletion.
*/
SerializableCallable callable = new SerializableCallable("Backup all members.") {
private final File baselineDir = getBaselineBackupDir();
@Override
public Object call() {
AdminDistributedSystem adminDS = null;
try {
DistributedSystemConfig config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
return adminDS.backupAllMembers(getIncrementalDir(), this.baselineDir);
} catch (AdminException e) {
throw new RuntimeException(e);
} finally {
if (adminDS != null) {
adminDS.disconnect();
}
}
}
};
/*
* Do an incremental after deleting the baseline. It should discover that the baseline is gone
* and backup all of the operation logs that are in the baseline.
*/
FileUtils.deleteDirectory(getBaselineDir());
Host.getHost(0).getVM(1).invoke(callable);
/*
* Find all of the member's oplogs in the incremental (*.crf,*.krf,*.drf)
*/
Collection<File> memberIncrementalOplogs = FileUtils.listFiles(getBackupDirForMember(getIncrementalDir(), memberId), new RegexFileFilter(OPLOG_REGEX), DirectoryFileFilter.DIRECTORY);
assertFalse(memberIncrementalOplogs.isEmpty());
List<String> memberIncrementalOplogNames = new LinkedList<>();
TransformUtils.transform(memberIncrementalOplogs, memberIncrementalOplogNames, TransformUtils.fileNameTransformer);
/*
* Assert that all of the baseline operation logs are in the incremental backup. If so, then the
* missing baseline was discovered by the incremental backup process.
*/
for (String oplog : memberBaselineOplogNames) {
assertTrue(memberIncrementalOplogNames.contains(oplog));
}
}
use of org.apache.geode.admin.AdminException in project geode by apache.
the class IncrementalBackupDUnitTest method incremental2.
/**
* Invokes {@link AdminDistributedSystem#backupAllMembers(File, File)} on a member.
*
* @param vm a member of the distributed system.
* @return a status of the backup operation.
*/
private BackupStatus incremental2(VM vm) {
return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {
@Override
public Object call() {
DistributedSystemConfig config;
AdminDistributedSystem adminDS = null;
try {
config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
return adminDS.backupAllMembers(getIncremental2Dir(), getIncrementalBackupDir());
} catch (AdminException e) {
throw new RuntimeException(e);
} finally {
if (adminDS != null) {
adminDS.disconnect();
}
}
}
});
}
Aggregations