Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

KafkaStreams itself is a notable example of this, but we can take the opportunity to look for other components that make sense as AutoCloseable as well."


From AutoCloseable.java's Javadoc:

...

An

...

object

...

that

...

may

...

hold

...

resources

...

(such

...

as

...

file

...

or

...

socket

...

handles)

...

until

...

it

...

is

...

closed.

...

The

...

{@link

...

#close()}

...

method

...

of

...

an

...

{@code

...

AutoCloseable}

...

object

...

is

...

called

...

automatically

...

when

...

exiting

...

a

...

{@code

...

try}-with-resources

...

block

...

for

...

which

...

the

...

object

...

has

...

been

...

declared

...

in

...

the

...

resource

...

specification

...

header.

...

This

...

construction

...

ensures

...

prompt

...

release,

...

avoiding

...

resource

...

exhaustion

...

exceptions

...

and

...

errors

...

that

...

may

...

otherwise

...

occur.

Public Interfaces

By going over the project, here is a list that I found which can implement AutoCloseable. Suggestions are welcome.

...