Last active
November 8, 2018 13:14
-
-
Save sirolf2009/310dc61710cc4140f5b11211c6e9fcb7 to your computer and use it in GitHub Desktop.
muse scrapbook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* DESIGN PATTERN | |
*/ | |
public class JobManager { | |
final BlockingQueue<? extends JobExecution> persistLastRun = new LinkedBlockingQueue<>(); | |
private JobManager() { | |
final Thread persistLastRunThread = new Thread(() -> { | |
while(true) { | |
try { | |
registerInZookeeper(persistLastRun.take()); | |
} catch(final Throwable e) { | |
log.error("Failed to persist a last run in zookeeper", e); | |
} | |
} | |
}, "Zookeeper Last Run Thread"); | |
} | |
private void registerInZookeeper(JobExecution execution) throws MalformedURLException, IOException { | |
zooguard.write("/cassandra/jobs/" + execution.getClass().getSimpleName() + "/" + execution.getJob().getParameterHashcode(), execution.getObjectId().toString()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println('''strokeText(«char.toString()», «column»*«charWidth», «lineInScreen»*«charHeight»)''') | |
println('''strokeText(«char.toString()», «column*charWidth», «lineInScreen*charHeight»)''') | |
strokeText(char.toString(), column*charWidth, lineInScreen*charHeight) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment