Skip to content

A thread and exception safe implementation of lazy (aka on-demand) value initialization.

License

Notifications You must be signed in to change notification settings

tinyj/tinyj-lazy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyj-lazy build status

A thread and exception safe implementation of lazy (aka on-demand) value initialization.

Features:

  • Initialization is guaranteed to run only once in multi-threaded scenarios as well in case of raised exceptions
  • The initializer is released after initialization so it can be collected by the garbage collector. This is still true if initialization fails.
  • Exception raised during initialization are propagated in the same thread (this is important if a InterruptedException for that thread is raised during initialization)
  • Exceptions raised during initialization are kept for later inspection/logging

API documentation

You can find the API documentation here.

Examples

See tests.

License

Copyright 2016 Eric Karge [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.