Skip to content

Commit

Permalink
1.5.6
Browse files Browse the repository at this point in the history
Move f.copy(Class<T[][]>, Object[][] to N.

Remove Collectors.pairing, replaced by Collectors.combine.

Change the implementation of ParallelArrayStream/ParallelIteratorStream.collect(Collector): All Collector will be executed with multiple threads, regardless the Characteristics.

Improvements and bug fix.
  • Loading branch information
landawn committed Mar 9, 2019
1 parent af356b6 commit aaf2d6a
Show file tree
Hide file tree
Showing 31 changed files with 212 additions and 241 deletions.
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,33 +182,33 @@ A general programming library in Java/Android. It's easy to learn and simple to
[RemoteExecutor](https://cdn.rawgit.com/landawn/AbacusUtil/master/docs/RemoteExecutor_view.html).

* More:
[Charsets](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Charsets.html),
[Ascii](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Ascii.html),
[CalendarUnit](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/CalendarUnit.html),
[NamingPolicy](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/NamingPolicy.html),
[Properties](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Properties.html),
[PropertiesUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/PropertiesUtil.html),
[Wrapper](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Wrapper.html),
[ArrayHashSet](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/ArrayHashSet.html),
[ArrayHashMap](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/ArrayHashMap.html),
[ClassUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/ClassUtil.html),
[EscapeUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/EscapeUtil.html),
[RegExUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/RegExUtil.html),
[FilenameUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/FilenameUtil.html),
[AWSJSONUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/AWSJSONUtil.html),
[AddrUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/AddrUtil.html),
[WSSecurityUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/WSSecurityUtil.html),
[EmailUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/EmailUtil.html),
[IEEE754rUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/IEEE754rUtil.html),
[Index](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Index.html),
[Median](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Median.html),
[f](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/f.html),
[Iterables](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Iterables.html),
[Matth](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Matth.html),
[SafeInitializer](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/SafeInitializer.html),
[Stopwatch](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Stopwatch.html),
[RateLimiter](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/RateLimiter.html),
[Traverser](https://static.javadoc.io/com.landawn/abacus-util/1.5.5/com/landawn/abacus/util/Traverser.html)(from Apache commons, Google Guava...) ...
[Charsets](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Charsets.html),
[Ascii](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Ascii.html),
[CalendarUnit](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/CalendarUnit.html),
[NamingPolicy](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/NamingPolicy.html),
[Properties](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Properties.html),
[PropertiesUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/PropertiesUtil.html),
[Wrapper](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Wrapper.html),
[ArrayHashSet](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/ArrayHashSet.html),
[ArrayHashMap](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/ArrayHashMap.html),
[ClassUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/ClassUtil.html),
[EscapeUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/EscapeUtil.html),
[RegExUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/RegExUtil.html),
[FilenameUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/FilenameUtil.html),
[AWSJSONUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/AWSJSONUtil.html),
[AddrUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/AddrUtil.html),
[WSSecurityUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/WSSecurityUtil.html),
[EmailUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/EmailUtil.html),
[IEEE754rUtil](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/IEEE754rUtil.html),
[Index](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Index.html),
[Median](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Median.html),
[f](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/f.html),
[Iterables](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Iterables.html),
[Matth](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Matth.html),
[SafeInitializer](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/SafeInitializer.html),
[Stopwatch](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Stopwatch.html),
[RateLimiter](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/RateLimiter.html),
[Traverser](https://static.javadoc.io/com.landawn/abacus-util/1.5.6/com/landawn/abacus/util/Traverser.html)(from Apache commons, Google Guava...) ...


## Download/Installation & [Changes](https://github.com/landawn/AbacusUtil/blob/master/CHANGES.md):
Expand All @@ -218,22 +218,22 @@ A general programming library in Java/Android. It's easy to learn and simple to
* Gradle:
```gradle
// JDK 1.8 or above:
compile 'com.landawn:abacus-util:1.5.5'
compile 'com.landawn:abacus-util:1.5.6'
// JDK 1.7:
compile 'com.landawn:abacus-util-jdk7:1.5.5'
compile 'com.landawn:abacus-util-jdk7:1.5.6'
// Android (Java 1.7):
compile 'abacus-android-jdk7:1.5.5'
compile 'abacus-android-jdk7:1.5.6'
// Android-SE (Java 1.7) - small edition without Stream/Matrix/Sheet/...:
compile 'abacus-android-se-jdk7:1.5.5'
compile 'abacus-android-se-jdk7:1.5.6'
// Android (Java 1.8 or above):
compile 'com.landawn:abacus-android:1.5.5'
compile 'com.landawn:abacus-android:1.5.6'
// Android-SE (Java 1.8 or above) - small edition without Stream/Matrix/Sheet/...:
compile 'com.landawn:abacus-android-se:1.5.5'
compile 'com.landawn:abacus-android-se:1.5.6'
```
### Functional Programming:
(It's very important to learn Lambdas and Stream APIs in Java 8 to get the best user experiences with the APIs provided in AbacusUtil)
Expand Down
Binary file modified docs/Sheet.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified lib/abacus-util-1.5.6.jar
Binary file not shown.
Binary file modified lib/abacus-util-jdk7-1.5.6.jar
Binary file not shown.
7 changes: 5 additions & 2 deletions src/com/landawn/abacus/DataSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Map;

import com.landawn.abacus.util.BiIterator;
import com.landawn.abacus.util.Builder.DataSetBuilder;
import com.landawn.abacus.util.ListMultimap;
import com.landawn.abacus.util.Multimap;
import com.landawn.abacus.util.ObjIterator;
Expand Down Expand Up @@ -247,7 +246,9 @@ public interface DataSet {
* @param columnIndex
* @param defaultValue
* @return
* @deprecated
*/
@Deprecated
<T> T getOrDefault(int columnIndex, T defaultValue);

/**
Expand All @@ -257,7 +258,9 @@ public interface DataSet {
* @param columnName
* @param defaultValue
* @return
* @deprecated
*/
@Deprecated
<T> T getOrDefault(String columnName, T defaultValue);

/**
Expand Down Expand Up @@ -4736,7 +4739,7 @@ DataSet fullJoin(DataSet right, Map<String, String> onColumnNames, String newCol

<T> Sheet<Integer, String, T> toSheet();

DataSetBuilder builder();
// DataSetBuilder builder();

/**
* it's same as: N.println(toString());
Expand Down
61 changes: 0 additions & 61 deletions src/com/landawn/abacus/cache/KryoTranscoder.java

This file was deleted.

10 changes: 4 additions & 6 deletions src/com/landawn/abacus/core/RowDataSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
import com.landawn.abacus.util.BufferedJSONWriter;
import com.landawn.abacus.util.BufferedWriter;
import com.landawn.abacus.util.BufferedXMLWriter;
import com.landawn.abacus.util.Builder;
import com.landawn.abacus.util.Builder.DataSetBuilder;
import com.landawn.abacus.util.ClassUtil;
import com.landawn.abacus.util.DateTimeFormat;
import com.landawn.abacus.util.Fn;
Expand Down Expand Up @@ -8709,10 +8707,10 @@ public <T> Sheet<Integer, String, T> toSheet() {
return (Sheet<Integer, String, T>) Sheet.columns(rowKeySet, this._columnNameList, this._columnList);
}

@Override
public DataSetBuilder builder() {
return Builder.of(this);
}
// @Override
// public DataSetBuilder builder() {
// return Builder.of(this);
// }

@Override
public void println() {
Expand Down
4 changes: 3 additions & 1 deletion src/com/landawn/abacus/http/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ public final class HttpClient extends AbstractHttpClient {
if (IOUtil.IS_PLATFORM_ANDROID) {
// ignore
} else {
final int maxConnections = IOUtil.CPU_CORES * 8;

System.setProperty("http.keepAlive", "true");
System.setProperty("http.maxConnections", "32");
System.setProperty("http.maxConnections", String.valueOf(maxConnections));
}
}

Expand Down
16 changes: 11 additions & 5 deletions src/com/landawn/abacus/http/OKHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private <T> T execute(final Class<T> resultClass, final OutputStream outputStrea

okhttp3.Request httpRequest = null;
okhttp3.Response httpResponse = null;
boolean closeOkHttpResponse = true;

try {
final okhttp3.Request.Builder requestBuilder = new okhttp3.Request.Builder()
Expand Down Expand Up @@ -268,16 +269,21 @@ private <T> T execute(final Class<T> resultClass, final OutputStream outputStrea
httpRequest = requestBuilder.build();
httpResponse = client.newCall(httpRequest).execute();

if (httpResponse.isSuccessful() == false && (resultClass == null || !resultClass.equals(HttpResponse.class))) {
if (httpResponse.isSuccessful() == false
&& (resultClass == null || !(resultClass.equals(HttpResponse.class) || resultClass.equals(okhttp3.Response.class)))) {
throw new UncheckedIOException(new IOException(httpResponse.code() + ": " + httpResponse.message()));
}

final ContentFormat responseContentFormat = HTTP.getContentFormat(httpResponse.header(HttpHeaders.Names.CONTENT_TYPE),
httpResponse.header(HttpHeaders.Names.CONTENT_ENCODING));

if (isOneWayRequest(settings)) {
return null;
} else if (resultClass.equals(okhttp3.Response.class)) {
closeOkHttpResponse = false;

return (T) httpResponse;
} else {
final ContentFormat responseContentFormat = HTTP.getContentFormat(httpResponse.header(HttpHeaders.Names.CONTENT_TYPE),
httpResponse.header(HttpHeaders.Names.CONTENT_ENCODING));

final InputStream is = HTTP.wrapInputStream(httpResponse.body().byteStream(), responseContentFormat);

if (outputStream != null) {
Expand Down Expand Up @@ -321,7 +327,7 @@ private <T> T execute(final Class<T> resultClass, final OutputStream outputStrea
} finally {
_activeConnectionCounter.decrementAndGet();

if (httpResponse != null) {
if (httpResponse != null && closeOkHttpResponse) {
httpResponse.close();
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/com/landawn/abacus/util/BiIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,15 @@ public static <K, V> BiIterator<K, V> of(final Map<K, V> map) {
return empty();
}

return of(map.entrySet().iterator());
}

public static <K, V> BiIterator<K, V> of(final Iterator<Map.Entry<K, V>> iter) {
if (iter == null) {
return empty();
}

return new BiIterator<K, V>() {
private final Iterator<Map.Entry<K, V>> iter = map.entrySet().iterator();

@Override
public boolean hasNext() {
Expand Down
2 changes: 1 addition & 1 deletion src/com/landawn/abacus/util/ExceptionalStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import com.landawn.abacus.util.stream.Stream;

/**
* The Stream will be automatically closed after execution(A terminal method is executed).
* The Stream will be automatically closed after execution(A terminal method is executed/triggered).
*
* @since 1.3
*
Expand Down
68 changes: 34 additions & 34 deletions src/com/landawn/abacus/util/JdbcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6335,40 +6335,40 @@ public boolean isActive() {
return status == Status.ACTIVE;
}

/**
* Attaches this transaction to current thread.
*
*/
public void attach() {
final String currentThreadName = Thread.currentThread().getName();
final String resourceId = ttid.substring(ttid.lastIndexOf('_') + 1);
final String targetTTID = currentThreadName + "_" + resourceId;

if (attachedThreadTransacionMap.containsKey(targetTTID)) {
throw new IllegalStateException("Transaction(id=" + attachedThreadTransacionMap.get(targetTTID).id()
+ ") has already been attached to current thread: " + currentThreadName);
} else if (threadTransacionMap.containsKey(targetTTID)) {
throw new IllegalStateException(
"Transaction(id=" + threadTransacionMap.get(targetTTID).id() + ") has already been created in current thread: " + currentThreadName);
}

attachedThreadTransacionMap.put(targetTTID, this);
threadTransacionMap.put(targetTTID, this);
}

public void detach() {
final String currentThreadName = Thread.currentThread().getName();
final String resourceId = ttid.substring(ttid.lastIndexOf('_') + 1);
final String targetTTID = currentThreadName + "_" + resourceId;

if (!attachedThreadTransacionMap.containsKey(targetTTID)) {
throw new IllegalStateException(
"Transaction(id=" + attachedThreadTransacionMap.get(targetTTID).id() + ") is not attached to current thread: " + currentThreadName);
}

threadTransacionMap.remove(targetTTID);
attachedThreadTransacionMap.remove(targetTTID);
}
// /**
// * Attaches this transaction to current thread.
// *
// */
// public void attach() {
// final String currentThreadName = Thread.currentThread().getName();
// final String resourceId = ttid.substring(ttid.lastIndexOf('_') + 1);
// final String targetTTID = currentThreadName + "_" + resourceId;
//
// if (attachedThreadTransacionMap.containsKey(targetTTID)) {
// throw new IllegalStateException("Transaction(id=" + attachedThreadTransacionMap.get(targetTTID).id()
// + ") has already been attached to current thread: " + currentThreadName);
// } else if (threadTransacionMap.containsKey(targetTTID)) {
// throw new IllegalStateException(
// "Transaction(id=" + threadTransacionMap.get(targetTTID).id() + ") has already been created in current thread: " + currentThreadName);
// }
//
// attachedThreadTransacionMap.put(targetTTID, this);
// threadTransacionMap.put(targetTTID, this);
// }
//
// public void detach() {
// final String currentThreadName = Thread.currentThread().getName();
// final String resourceId = ttid.substring(ttid.lastIndexOf('_') + 1);
// final String targetTTID = currentThreadName + "_" + resourceId;
//
// if (!attachedThreadTransacionMap.containsKey(targetTTID)) {
// throw new IllegalStateException(
// "Transaction(id=" + attachedThreadTransacionMap.get(targetTTID).id() + ") is not attached to current thread: " + currentThreadName);
// }
//
// threadTransacionMap.remove(targetTTID);
// attachedThreadTransacionMap.remove(targetTTID);
// }

public void commit() throws SQLException {
final int refCount = decrementAndGetRef();
Expand Down
Loading

0 comments on commit aaf2d6a

Please sign in to comment.