@InterfaceAudience.Private public abstract class FileSystemReleaseFilter extends Object implements javax.servlet.Filter
FileSystemReleaseFilter
releases back to the
FileSystemAccess
service a FileSystem
instance.
This filter is useful in situations where a servlet request is streaming out HDFS data and the corresponding filesystem instance have to be closed after the streaming completes.
Constructor and Description |
---|
FileSystemReleaseFilter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys the filter.
|
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
It delegates the incoming request to the
FilterChain , and
at its completion (in a finally block) releases the filesystem instance
back to the FileSystemAccess service. |
protected abstract FileSystemAccess |
getFileSystemAccess()
Abstract method to be implemetned by concrete implementations of the
filter that return the
FileSystemAccess service to which the filesystem
will be returned to. |
void |
init(javax.servlet.FilterConfig filterConfig)
Initializes the filter.
|
static void |
setFileSystem(org.apache.hadoop.fs.FileSystem fs)
Static method that sets the
FileSystem to release back to
the FileSystemAccess service on servlet request completion. |
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
This implementation is a NOP.
init
in interface javax.servlet.Filter
filterConfig
- filter configuration.javax.servlet.ServletException
- thrown if the filter could not be initialized.public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
FilterChain
, and
at its completion (in a finally block) releases the filesystem instance
back to the FileSystemAccess
service.doFilter
in interface javax.servlet.Filter
servletRequest
- servlet request.servletResponse
- servlet response.filterChain
- filter chain.IOException
- thrown if an IO error occurs.javax.servlet.ServletException
- thrown if a servlet error occurs.public void destroy()
This implementation is a NOP.
destroy
in interface javax.servlet.Filter
public static void setFileSystem(org.apache.hadoop.fs.FileSystem fs)
FileSystem
to release back to
the FileSystemAccess
service on servlet request completion.fs
- fileystem instance.protected abstract FileSystemAccess getFileSystemAccess()
FileSystemAccess
service to which the filesystem
will be returned to.Copyright © 2008–2018 Apache Software Foundation. All rights reserved.