Skip to content

Commit

Permalink
Reimplemented ExecutorService usage internal to AsyncScalr -- will make
Browse files Browse the repository at this point in the history
customization much easier and intuitive.

Provided two custom ThreadFactory implementations in AsyncScalr for use
in the most common execution environments (client apps or server apps).

Rewrote the customization section of AsyncScalr Javadoc to clarify
exactly how to use all these changes.
  • Loading branch information
Riyad Kalla committed Nov 8, 2011
1 parent 8b807b4 commit a41dadd
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 90 deletions.
71 changes: 41 additions & 30 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Changelog
---------
4.0 (in progress...)
* [BREAKING] Package has changed from com.thebuzzmedia.imgscalr to
org.imgscalr.
org.imgscalr - I am sorry for the inconvenience of this, but this is
necessary. There will be a family of imgscalr-based Java utilities coming
out in the future (ExifTool is next) that will all be under this umbrella.

* [BREAKING] Java 6 is now required for using imgscalr.

The reason for this is because imgscalr not includes specific types of
The reason for this is because imgscalr includes specific types of
ResizeOp and ColorConvertOps that actually segfault the latest Java 5 VM
when applied, but run fine in Java 6 and 7.

Expand All @@ -26,31 +28,30 @@ Changelog
being out for 5 years, it seemed like a reasonable requirement.

* [BREAKING] Rotation enum was totally redefined. All rotations were
redefined in terms of 90,180,270 quadrant rotations.
redefined in terms of 90,180,270 quadrant rotations as well as h/v FLIP.

* [BREAKING] All resize(...) methods that accepted Rotation enums are
removed.
removed. All graphic operations are now separate and discrete, but can be
easily combined when multiple effects are wanted.

* [MAJOR] All operations are now encapsulated inside of IOp implementations
in the "op" sub package. Scalr and AsyncScalr can still be used to execute
individual operations quickly, but to execute multiple operations in quick
succession you can pass a list of Ops to Scalr or AsyncScalr to run for you
or use OpBuilder to use the builder pattern to easily create a chain of
operations to create and execute against an image.
* Added apply() support for applying an arbitrary list of BufferedImageOps
SAFELY and efficiently working around all the bugs in the JDK pertaining
to BufferedImageOps (also used internally when applying any optionally
specified ops).

* Added crop() support.

* Added pad() support.

* Added op() support for applying an arbitrary list of BufferedImageOps
SAFELY and efficiently working around all the bugs in the JDK pertaining
to BufferedImageOps (also used internally when applying any optionally
specified ops).

* Added rotate() support.

* Support for crop, op, pad and rotate were all added to AsyncScalr so these
operations can all be asynchronously performed as well.
* All graphic operations (even new ones) were modified to allow the
application of 1 or more BufferedImageOps to a final image result before
returning it for convenience.

* Support for all the new operations (apply, crop, pad, rotate) were all
added to AsyncScalr so these operations can all be asynchronously performed
as well.

* Added support for horizontal and vertical flipping of the image via the
Rotation enum and new rotate() method.
Expand All @@ -63,20 +64,39 @@ Changelog
orientation and proportions automatically.

* AsyncScalr's use of ExecutorService was rewritten; no more support for
passing in custom ExecutorService implementations -- just extend the class
and specify your own logic.
passing in custom ExecutorService implementations or modifying existing ones
on the fly and having the class do something magic to them under the
covers (that was bad) -- just extend the class and specify your own logic.

* AsyncScalr can be easily customized now through a single method:

- createService()
OR
- createService(ThreadFactory)

* AsyncScalr provides two custom ThreadFactory implementations for subclasses
to use if they want to customize the types of Threads generated and used
internally for async scale operations.

- DefaultThreadFactory creates default threads with all default settings.
- ServerThreadFactory generates threads that are optimized to execute in
a server environment (daemon threads w/ LOW_PRIORITY).

* AsyncScalr.DEFAULT_THREAD_COUNT was removed and replaced with THREAD_COUNT
that can be customized and set via system properties.

AsyncScalr.service is now protected and managed by a single protected method
that both can be easily overwritten by a subclass and customized if desired.
* AsyncScalr.THREAD_COUNT's property name was separated into a String constant
to make it easier to work with.

* Simplified the resize() calls as a result of making all operations discrete;
8 duplicate methods accepting "rotation" arguments were removed.

* Optimized the application of BufferedImageOps.

* Fixed a bug in the application of BufferedImageOps which could have led
to an ImagingOpException bubbling up from native Java2D or a corrupt (black)
image for poorly supported image types.

* Memory optimized the application of 2 or more BufferedImageOps (interim
images are explicitly cleaned up just like in incremental scaling).

Expand Down Expand Up @@ -124,15 +144,6 @@ Changelog
all the methods to more clearly communicate what is happening inside the
method and to the original images.

* [TIP] Because image operations have been made discrete operations
(e.g. flip, rotate, crop, etc.) imgscalr cannot automatically .flush() the
src images. Callers must remember to do this to help avoid leaking memory
or making the GC life harder.

To be clear, imgscalr will continue to flush interim graphics that it manages
internally, but if you are doing a lot of discrete image ops yourself, don't
forget to cleanup.


3.2
* Added support for asynchronous & rate-limited scaling operations via the
Expand Down
Loading

0 comments on commit a41dadd

Please sign in to comment.