1 package com.google.inject.servlet; 2 3 import java.io.Closeable; 4 5 /** Object that can be used to apply a request scope to a block of code. */ 6 public interface RequestScoper { 7 /** 8 * Opens up the request scope until the returned object is closed. Implementations should ensure 9 * (e.g. by blocking) that multiple threads cannot open the same request scope concurrently. It is 10 * allowable to open the same request scope on the same thread, as long as open/close calls are 11 * correctly nested. 12 */ open()13 CloseableScope open(); 14 15 /** Closeable subclass that does not throw any exceptions from close. */ 16 public interface CloseableScope extends Closeable { 17 @Override close()18 void close(); 19 } 20 } 21