Skip to content

Commit

Permalink
write a line into test.file
Browse files Browse the repository at this point in the history
  • Loading branch information
huifer committed Nov 21, 2023
1 parent 8a0d218 commit 05ae74b
Show file tree
Hide file tree
Showing 6 changed files with 366 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/spring/cs5b72623a-880e-11ee-aac4-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.huifer.springboot.mysql.pojo.two;

import lombok.Builder;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;

/**
* <p>Title : StudentTwo </p>
* <p>Description : </p>
*
* @author huifer
* @date 2019-06-28
*/
@Entity
@Data
@ToString
@Builder
@Table(name = "student_two")
public class StudentTwo {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;


private String name;
private Integer age;
private String address;
}
37 changes: 37 additions & 0 deletions docs/spring/cs5bcc7fae-880e-11ee-aac4-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright 2009-2016 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package org.apache.ibatis.submitted.lazy_properties;

import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface Mapper {
User getUser(Integer id);

@ResultMap("user")
@Select("select 11 id, 'lazy1' name from (values(0))")
User getLazy1();

@ResultMap("user")
@Select("select 12 id, 'lazy2' name from (values(0))")
User getLazy2();

@ResultMap("user")
@Select("select 13 id, 'lazy3' name from (values(0))")
List<User> getLazy3();
}
44 changes: 44 additions & 0 deletions docs/spring/cs5c29a5f8-880e-11ee-aac4-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2009-2019 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package org.apache.ibatis.submitted.nested;

import java.util.ArrayList;
import java.util.List;

public class Name {
private String lastName;
private List<String> firstNames;

public Name() {
firstNames = new ArrayList<>();
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public List<String> getFirstNames() {
return firstNames;
}

public void addFirstName(String firstName) {
firstNames.add(firstName);
}
}
22 changes: 22 additions & 0 deletions docs/spring/cs5c830288-880e-11ee-aac4-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.huifer.rmi.jdk;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
* <p>Title : HelloServiceImpl </p>
* <p>Description : </p>
*
* @author huifer
* @date 2019-06-11
*/
public class HelloServiceImpl extends UnicastRemoteObject implements HelloService {

public HelloServiceImpl() throws RemoteException {
super();
}

public String hello(String msg) throws RemoteException {
return "msg:" + msg;
}
}
184 changes: 184 additions & 0 deletions docs/spring/cs5cd7603a-880e-11ee-aac4-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/**
* Copyright 2009-2019 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package org.apache.ibatis.binding;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.domain.blog.Author;
import org.apache.ibatis.domain.blog.Post;
import org.apache.ibatis.domain.blog.Section;
import org.apache.ibatis.executor.BatchResult;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

@CacheNamespace(readWrite = false)
public interface BoundAuthorMapper {

//======================================================

List<Post> findPostsInArray(Integer[] ids);

//======================================================

List<Post> findPostsInList(List<Integer> ids);

//======================================================

int insertAuthor(Author author);

int insertAuthorInvalidSelectKey(Author author);

int insertAuthorInvalidInsert(Author author);

int insertAuthorDynamic(Author author);

//======================================================

@ConstructorArgs({
@Arg(column = "AUTHOR_ID", javaType = int.class)
})
@Results({
@Result(property = "username", column = "AUTHOR_USERNAME"),
@Result(property = "password", column = "AUTHOR_PASSWORD"),
@Result(property = "email", column = "AUTHOR_EMAIL"),
@Result(property = "bio", column = "AUTHOR_BIO")
})
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME,",
" PASSWORD as AUTHOR_PASSWORD,",
" EMAIL as AUTHOR_EMAIL,",
" BIO as AUTHOR_BIO",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthor(int id);

//======================================================

@Result(property = "id", column = "AUTHOR_ID", id = true)
@Result(property = "username", column = "AUTHOR_USERNAME")
@Result(property = "password", column = "AUTHOR_PASSWORD")
@Result(property = "email", column = "AUTHOR_EMAIL")
@Result(property = "bio", column = "AUTHOR_BIO")
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME,",
" PASSWORD as AUTHOR_PASSWORD,",
" EMAIL as AUTHOR_EMAIL,",
" BIO as AUTHOR_BIO",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthorMapToPropertiesUsingRepeatable(int id);

//======================================================

@ConstructorArgs({
@Arg(column = "AUTHOR_ID", javaType = Integer.class),
@Arg(column = "AUTHOR_USERNAME", javaType = String.class),
@Arg(column = "AUTHOR_PASSWORD", javaType = String.class),
@Arg(column = "AUTHOR_EMAIL", javaType = String.class),
@Arg(column = "AUTHOR_BIO", javaType = String.class),
@Arg(column = "AUTHOR_SECTION", javaType = Section.class)
})
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME,",
" PASSWORD as AUTHOR_PASSWORD,",
" EMAIL as AUTHOR_EMAIL,",
" BIO as AUTHOR_BIO," +
" FAVOURITE_SECTION as AUTHOR_SECTION",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthorConstructor(int id);

//======================================================

@Arg(column = "AUTHOR_ID", javaType = Integer.class, id = true)
@Arg(column = "AUTHOR_USERNAME", javaType = String.class)
@Arg(column = "AUTHOR_PASSWORD", javaType = String.class)
@Arg(column = "AUTHOR_EMAIL", javaType = String.class)
@Arg(column = "AUTHOR_BIO", javaType = String.class)
@Arg(column = "AUTHOR_SECTION", javaType = Section.class)
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME,",
" PASSWORD as AUTHOR_PASSWORD,",
" EMAIL as AUTHOR_EMAIL,",
" BIO as AUTHOR_BIO," +
" FAVOURITE_SECTION as AUTHOR_SECTION",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthorMapToConstructorUsingRepeatable(int id);

//======================================================

@Arg(column = "AUTHOR_ID", javaType = int.class)
@Result(property = "username", column = "AUTHOR_USERNAME")
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME,",
" PASSWORD as AUTHOR_PASSWORD,",
" EMAIL as AUTHOR_EMAIL,",
" BIO as AUTHOR_BIO",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthorUsingSingleRepeatable(int id);

//======================================================

@ConstructorArgs({
@Arg(column = "AUTHOR_ID", javaType = Integer.class),
@Arg(column = "AUTHOR_USERNAME", javaType = String.class),
@Arg(column = "AUTHOR_PASSWORD", javaType = String.class),
@Arg(column = "AUTHOR_EMAIL", javaType = String.class),
@Arg(column = "AUTHOR_BIO", javaType = String.class)
})
@Arg(column = "AUTHOR_SECTION", javaType = Section.class)
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME,",
" PASSWORD as AUTHOR_PASSWORD,",
" EMAIL as AUTHOR_EMAIL,",
" BIO as AUTHOR_BIO," +
" FAVOURITE_SECTION as AUTHOR_SECTION",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthorUsingBothArgAndConstructorArgs(int id);

//======================================================

@Results(
@Result(property = "id", column = "AUTHOR_ID")
)
@Result(property = "username", column = "AUTHOR_USERNAME")
@Select({
"SELECT ",
" ID as AUTHOR_ID,",
" USERNAME as AUTHOR_USERNAME",
"FROM AUTHOR WHERE ID = #{id}"})
Author selectAuthorUsingBothResultAndResults(int id);

//======================================================

List<Post> findThreeSpecificPosts(@Param("one") int one,
RowBounds rowBounds,
@Param("two") int two,
int three);

@Flush
List<BatchResult> flush();

}
48 changes: 48 additions & 0 deletions docs/spring/cs5d1493c4-880e-11ee-aac4-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.huifer.concurrence.ch1;

import java.util.ArrayList;
import java.util.List;

/**
* <p>Title : ThreadYield </p>
* <p>Description : yield</p>
*
* @author huifer
* @date 2019-03-27
*/
public class ThreadYield {

public static void main(String[] args) {
Task task1 = new Task(true);
Task task2 = new Task(false);
new Thread(task1).start();
new Thread(task2).start();
}


private static class Task implements Runnable {

private final boolean isYield;
private List<String> stringList = new ArrayList<>();

public Task(boolean isYield) {
this.isYield = isYield;
}

@Override
public void run() {
String name = Thread.currentThread().getName();
System.out.println(name + " start:");
for (int i = 0; i < 1000000; i++) {
if (isYield) {
stringList.add("NO." + i);
Thread.yield();
}
}
System.out.println(name + " end:");

}
}


}

0 comments on commit 05ae74b

Please sign in to comment.