Skip to content

Commit f756689

Browse files
committed
add an example of AutoCloseable component
1 parent 98f97f1 commit f756689

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package samplest.lifecycle;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
import restx.factory.AutoStartable;
6+
import restx.factory.Component;
7+
8+
/**
9+
* Date: 3/2/15
10+
* Time: 21:56
11+
*/
12+
@Component
13+
public class AutoCloseableSample implements AutoStartable, AutoCloseable {
14+
private static final Logger logger = LoggerFactory.getLogger(AutoCloseableSample.class);
15+
16+
@Override
17+
public void start() {
18+
logger.info("starting {}", this);
19+
}
20+
21+
@Override
22+
public void close() throws Exception {
23+
logger.info("closing {}", this);
24+
}
25+
}

0 commit comments

Comments
 (0)