本文整理汇总了Java中org.apache.falcon.FalconException类的典型用法代码示例。如果您正苦于以下问题:Java FalconException类的具体用法?Java FalconException怎么用?Java FalconException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FalconException类属于org.apache.falcon包,在下文中一共展示了FalconException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void init() throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.init()");
}
try {
activatePluginClassLoader();
ConfigurationStore.get().registerListener(this);
falconServiceImpl.init();
} finally {
deactivatePluginClassLoader();
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.init()");
}
}
示例2: destroy
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void destroy() throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.destroy()");
}
try {
activatePluginClassLoader();
ConfigurationStore.get().unregisterListener(this);
falconServiceImpl.destroy();
} finally {
deactivatePluginClassLoader();
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.destroy()");
}
}
示例3: onAdd
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void onAdd(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onAdd({})", entity);
}
try {
activatePluginClassLoader();
configChangeListenerImpl.onAdd(entity);
} finally {
deactivatePluginClassLoader();
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onAdd({})", entity);
}
}
示例4: onRemove
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void onRemove(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onRemove({})", entity);
}
try {
activatePluginClassLoader();
configChangeListenerImpl.onRemove(entity);
} finally {
deactivatePluginClassLoader();
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onRemove({})", entity);
}
}
示例5: onChange
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void onChange(Entity entity, Entity entity1) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onChange({}, {})", entity, entity1);
}
try {
activatePluginClassLoader();
configChangeListenerImpl.onChange(entity, entity1);
} finally {
deactivatePluginClassLoader();
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onChange({}, {})", entity, entity1);
}
}
示例6: onReload
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void onReload(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onReload({})", entity);
}
try {
activatePluginClassLoader();
configChangeListenerImpl.onReload(entity);
} finally {
deactivatePluginClassLoader();
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onReload({})", entity);
}
}
示例7: onAdd
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void onAdd(Entity entity) throws FalconException {
try {
EntityType entityType = entity.getEntityType();
switch (entityType) {
case CLUSTER:
addEntity(entity, FalconEvent.OPERATION.ADD_CLUSTER);
break;
case PROCESS:
addEntity(entity, FalconEvent.OPERATION.ADD_PROCESS);
break;
case FEED:
addEntity(entity, FalconEvent.OPERATION.ADD_FEED);
break;
default:
LOG.debug("Entity type not processed {}", entityType);
}
} catch(Throwable t) {
LOG.warn("Error handling entity {}", entity, t);
}
}
示例8: onChange
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void onChange(Entity oldEntity, Entity newEntity) throws FalconException {
/**
* Skipping update for now - update uses full update currently and this might result in all attributes wiped for hive entities
EntityType entityType = newEntity.getEntityType();
switch (entityType) {
case CLUSTER:
addEntity(newEntity, FalconEvent.OPERATION.UPDATE_CLUSTER);
break;
case PROCESS:
addEntity(newEntity, FalconEvent.OPERATION.UPDATE_PROCESS);
break;
case FEED:
FalconEvent.OPERATION operation = isReplicationFeed((Feed) newEntity) ?
FalconEvent.OPERATION.UPDATE_REPLICATION_FEED :
FalconEvent.OPERATION.UPDATE_FEED;
addEntity(newEntity, operation);
break;
default:
LOG.debug("Entity type not processed {}", entityType);
}
**/
}
示例9: getDelay
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public long getDelay(Frequency delay, Date nominalTime, Date cutOffTime)
throws FalconException {
ExpressionHelper evaluator = ExpressionHelper.get();
Date now = new Date();
Date lateTime = nominalTime;
long delayMilliSeconds = evaluator.evaluate(delay.toString(),
Long.class);
int factor = 1;
// TODO we can get rid of this using formula
while (lateTime.compareTo(now) <= 0) {
lateTime = addTime(lateTime, (int) (factor * delayMilliSeconds));
factor *= getPower();
}
if (lateTime.after(cutOffTime)) {
lateTime = cutOffTime;
}
return (lateTime.getTime() - nominalTime.getTime());
}
示例10: afterDelete
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Override
public void afterDelete(Entity entity, String clusterName) throws FalconException {
try {
Cluster cluster = EntityUtil.getEntity(EntityType.CLUSTER, clusterName);
Path entityPath = new Path(ClusterHelper.getLocation(cluster, "staging"),
EntityUtil.getStagingPath(entity)).getParent();
LOG.info("Deleting entity path " + entityPath + " on cluster " + clusterName);
Configuration conf = ClusterHelper.getConfiguration(cluster);
FileSystem fs = FileSystem.get(conf);
if (fs.exists(entityPath) && !fs.delete(entityPath, true)) {
throw new FalconException("Unable to cleanup entity path: " + entityPath);
}
} catch (Exception e) {
throw new FalconException(
"Failed to cleanup entity path for " + entity.toShortString() + " on cluster " + clusterName, e);
}
}
示例11: validateFeedRetentionPeriod
import org.apache.falcon.FalconException; //导入依赖的package包/类
public static void validateFeedRetentionPeriod(String startInstance, Feed feed, String clusterName)
throws FalconException {
String feedRetention = FeedHelper.getCluster(feed, clusterName).getRetention().getLimit().toString();
ExpressionHelper evaluator = ExpressionHelper.get();
Date now = new Date();
ExpressionHelper.setReferenceDate(now);
Date instStart = evaluator.evaluate(startInstance, Date.class);
long feedDuration = evaluator.evaluate(feedRetention, Long.class);
Date feedStart = new Date(now.getTime() - feedDuration);
if (instStart.before(feedStart)) {
throw new ValidationException("StartInstance :" + startInstance + " of process is out of range for Feed: "
+ feed.getName() + " in cluster: " + clusterName + "'s retention limit :" + feedRetention);
}
}
示例12: getReplicationCoordinators
import org.apache.falcon.FalconException; //导入依赖的package包/类
private List<COORDINATORAPP> getReplicationCoordinators(Cluster targetCluster, Path bundlePath)
throws FalconException {
Feed feed = getEntity();
List<COORDINATORAPP> replicationCoords = new ArrayList<COORDINATORAPP>();
if (FeedHelper.getCluster(feed, targetCluster.getName()).getType() == ClusterType.TARGET) {
String coordName = EntityUtil.getWorkflowName(Tag.REPLICATION, feed).toString();
Path basePath = getCoordPath(bundlePath, coordName);
createReplicatonWorkflow(targetCluster, basePath, coordName);
for (org.apache.falcon.entity.v0.feed.Cluster feedCluster : feed.getClusters().getClusters()) {
if (feedCluster.getType() == ClusterType.SOURCE) {
COORDINATORAPP coord = createAndGetCoord(feed,
(Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, feedCluster.getName()),
targetCluster,
bundlePath);
if (coord != null) {
replicationCoords.add(coord);
}
}
}
}
return replicationCoords;
}
示例13: afterAction
import org.apache.falcon.FalconException; //导入依赖的package包/类
private void afterAction(Entity entity, BundleAction action, String cluster)
throws FalconException {
for (WorkflowEngineActionListener listener : listeners) {
switch (action) {
case SUSPEND:
listener.afterSuspend(entity, cluster);
break;
case RESUME:
listener.afterResume(entity, cluster);
break;
case KILL:
listener.afterDelete(entity, cluster);
break;
default:
}
}
}
示例14: validateFeedCutOffPeriod
import org.apache.falcon.FalconException; //导入依赖的package包/类
private void validateFeedCutOffPeriod(Feed feed, Cluster cluster) throws FalconException {
ExpressionHelper evaluator = ExpressionHelper.get();
String feedRetention = cluster.getRetention().getLimit().toString();
long retentionPeriod = evaluator.evaluate(feedRetention, Long.class);
if (feed.getLateArrival() == null) {
LOG.debug("Feed's late arrival cut-off not set");
return;
}
String feedCutoff = feed.getLateArrival().getCutOff().toString();
long feedCutOffPeriod = evaluator.evaluate(feedCutoff, Long.class);
if (retentionPeriod < feedCutOffPeriod) {
throw new ValidationException(
"Feed's retention limit: " + feedRetention + " of referenced cluster " + cluster.getName()
+ " should be more than feed's late arrival cut-off period: " + feedCutoff + " for feed: "
+ feed.getName());
}
}
示例15: TestExpBackoffPolicy
import org.apache.falcon.FalconException; //导入依赖的package包/类
@Test
public void TestExpBackoffPolicy() throws FalconException {
AbstractRerunPolicy backoff = new ExpBackoffPolicy();
long delay = backoff.getDelay(new Frequency("minutes(2)"), 2);
Assert.assertEquals(delay, 480000);
long currentTime = System.currentTimeMillis();
delay = backoff.getDelay(new Frequency("minutes(2)"), new Date(
currentTime - 1 * 4 * 60 * 1000), new Date(currentTime + 1 * 60
* 60 * 1000));
Assert.assertEquals(delay, 1 * 6 * 60 * 1000);
currentTime = System.currentTimeMillis();
delay = backoff.getDelay(new Frequency("minutes(1)"), new Date(
currentTime - 1 * 9 * 60 * 1000), new Date(currentTime + 1 * 60
* 60 * 1000));
Assert.assertEquals(delay, 900000);
}