Permalink
Browse files

add an example of AutoCloseable component

  • Loading branch information...
xhanin committed Feb 3, 2015
1 parent 98f97f1 commit f756689ba86194d740c7ae198c009655a24a3d73
Showing with 25 additions and 0 deletions.
  1. +25 −0 restx-samplest/src/main/java/samplest/lifecycle/AutoCloseableSample.java
@@ -0,0 +1,25 @@
+package samplest.lifecycle;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import restx.factory.AutoStartable;
+import restx.factory.Component;
+
+/**
+ * Date: 3/2/15
+ * Time: 21:56
+ */
+@Component
+public class AutoCloseableSample implements AutoStartable, AutoCloseable {
+ private static final Logger logger = LoggerFactory.getLogger(AutoCloseableSample.class);
+
+ @Override
+ public void start() {
+ logger.info("starting {}", this);
+ }
+
+ @Override
+ public void close() throws Exception {
+ logger.info("closing {}", this);
+ }
+}

0 comments on commit f756689

Please sign in to comment.