Example usage for com.amazonaws.services.simpledb.model GetAttributesResult toString

List of usage examples for com.amazonaws.services.simpledb.model GetAttributesResult toString

Introduction

In this page you can find the example usage for com.amazonaws.services.simpledb.model GetAttributesResult toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns a string representation of this object.

Usage

From source file:com.threepillar.labs.quartz.simpledb.SimpleDbJobStore.java

License:Apache License

/**
 * <p>/*from w ww . j a  v  a  2s.c  o m*/
 * Pause the <code>{@link Trigger}</code> with the given name.
 * </p>
 */
@Override
public void pauseTrigger(SchedulingContext ctxt, String triggerName, String groupName) {
    logDebug("Pausing Trigger: ", triggerName, ".", groupName);
    String key = TriggerWrapper.getTriggerNameKey(triggerName, groupName);
    GetAttributesResult result = amazonSimpleDb
            .getAttributes(new GetAttributesRequest(triggerDomain, key).withConsistentRead(Boolean.TRUE));
    TriggerWrapper tw = null;

    try {
        tw = triggerFromAttributes(result.getAttributes());
    } catch (IOException e) {
        log.error("Could not create trigger for Item: " + result.toString(), e);
    }

    // does the trigger exist?
    if (tw == null || tw.trigger == null) {
        return;
    }

    // if the trigger is "complete" pausing it does not make sense...
    if (tw.state == TriggerWrapper.STATE_COMPLETE) {
        return;
    }

    if (tw.state == TriggerWrapper.STATE_BLOCKED) {
        tw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
    } else {
        tw.state = TriggerWrapper.STATE_PAUSED;
    }

    updateState(tw);

}

From source file:com.threepillar.labs.quartz.simpledb.SimpleDbJobStore.java

License:Apache License

/**
 * <p>/*from   ww  w .  j a v  a  2s .  c  o  m*/
 * Resume (un-pause) the <code>{@link Trigger}</code> with the given name.
 * </p>
 * <p/>
 * <p>
 * If the <code>Trigger</code> missed one or more fire-times, then the
 * <code>Trigger</code>'s misfire instruction will be applied.
 * </p>
 */
@Override
public void resumeTrigger(SchedulingContext ctxt, String triggerName, String groupName) {
    logDebug("Resuming Trigger: ", triggerName, ".", groupName);
    String key = TriggerWrapper.getTriggerNameKey(triggerName, groupName);

    GetAttributesResult result = amazonSimpleDb
            .getAttributes(new GetAttributesRequest(triggerDomain, key).withConsistentRead(Boolean.TRUE));
    TriggerWrapper tw = null;

    try {
        tw = triggerFromAttributes(result.getAttributes());
    } catch (IOException e) {
        log.error("Could not create trigger for Item: " + result.toString());
    }

    // does the trigger exist?
    if (tw == null || tw.trigger == null) {
        return;
    }

    // if the trigger is not paused resuming it does not make sense...
    if (tw.state != TriggerWrapper.STATE_PAUSED && tw.state != TriggerWrapper.STATE_PAUSED_BLOCKED) {
        return;
    }
    applyMisfire(tw);

}