Changes for scalagen.

This commit is contained in:
Greg Burd 2019-06-30 15:20:47 -04:00
parent e7649b44cb
commit 1c345dae8a
6 changed files with 46 additions and 6 deletions

22
COPYRIGHT Normal file
View file

@ -0,0 +1,22 @@
/*
* Copyright (C) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (C) 2019, Stasis Software Systems, Inc. All rights reserved.
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you 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.
*
* Please see the LICENSE file included in the top-level directory of this
* project for additional information.
*/

10
NOTES
View file

@ -10,4 +10,14 @@
* Jepsen
* Nested transactions
* Scalagen
* <> -> typed
* exceptions multi-catch, separate
* try with resources, use finally
* //, /*- and /* comment don't migrate
* enum classes
* multiple private constructors
* @BeanProperty
* copyright
* http://dbmsmusings.blogspot.com/2019/06/correctness-anomalies-under.html

View file

@ -139,13 +139,16 @@ public class RestoreMarker {
SingleItemEntry.create(LogEntryType.LOG_RESTORE_REQUIRED, rr);
ByteBuffer buf2 = logManager.putIntoBuffer(marker, 0);
try (FileOutputStream stream = new FileOutputStream(lastFile);
FileChannel channel = stream.getChannel()) {
FileOutputStream stream = new FileOutputStream(lastFile);
FileChannel channel = stream.getChannel();
try {
channel.write(buf1);
channel.write(buf2);
} catch (IOException e) {
/* the stream and channel will be closed */
throw e;
} finally {
channel.close();
}
} catch (IOException ioe) {
throw new FileCreationException(

View file

@ -86,8 +86,13 @@ abstract class BaseEntry<T extends Loggable> implements LogEntry {
final Constructor<T> noArgsConstructor) {
try {
return noArgsConstructor.newInstance((Object[]) null);
} catch (IllegalAccessException | InstantiationException |
IllegalArgumentException | InvocationTargetException e) {
} catch (IllegalAccessException e) {
throw EnvironmentFailureException.unexpectedException(e);
} catch (InstantiationException e) {
throw EnvironmentFailureException.unexpectedException(e);
} catch (IllegalArgumentException e) {
throw EnvironmentFailureException.unexpectedException(e);
} catch (InvocationTargetException e) {
throw EnvironmentFailureException.unexpectedException(e);
}
}

View file

@ -284,7 +284,7 @@ public class LNLogEntry<T extends LN> extends BaseReplicableEntry<T> {
* @return the log entry
*/
public static <T extends LN> LNLogEntry<T> create(final Class<T> cls) {
return new LNLogEntry<>(cls);
return new LNLogEntry<T>(cls);
}
/* Constructor to read an entry. */

View file

@ -206,7 +206,7 @@ public class NameLNLogEntry extends LNLogEntry<NameLN> {
@Override
public Collection<VersionedWriteLoggable> getEmbeddedLoggables() {
final Collection<VersionedWriteLoggable> list =
new ArrayList<>(super.getEmbeddedLoggables());
new ArrayList<VersionedWriteLoggable>(super.getEmbeddedLoggables());
list.addAll(Arrays.asList(
new NameLN(), DbOperationType.NONE,
new ReplicatedDatabaseConfig()));